Bugzilla – Attachment 18142 Details for
Bug 10214
malformed syspref.po file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10214 Add header to syspref po files
PASSED-QA-Bug-10214-Add-header-to-syspref-po-files.patch (text/plain), 2.96 KB, created by
Katrin Fischer
on 2013-05-15 05:41:42 UTC
(
hide
)
Description:
[PASSED QA] Bug 10214 Add header to syspref po files
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-05-15 05:41:42 UTC
Size:
2.96 KB
patch
obsolete
>From c4f4e14b3825498758b1f04d38fa491c70310d6e Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Tue, 14 May 2013 13:01:56 +0200 >Subject: [PATCH] [PASSED QA] Bug 10214 Add header to syspref po files > >With this patch, header is created when creating a new syspref .po file >for a new language (translate create), and is added if it doesn't >already exist when updating an existing language (translate update). > >To test: > >(1) Create a new language syspref file: > > ./translate create -p xx-XX > > Check that there is an header > >(2) Update an existing syspref file without header: > > ./translate update fr-FR > > Check that fr-FR-pref.po has a header > >(3) Update an existing syspref file with header: > > Modify fr-FR-pref.po. Add an email, or whatever. > > ./translate update fr-FR > > Check that fr-FR-pref.po has a header with the manual modification > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Comment: Work as described. No errors. > >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >All tests and QA script pass. >Also tested that updated pref files can still be installed correctly. >--- > misc/translator/LangInstaller.pm | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 00daaf4..e5371e6 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -29,6 +29,19 @@ use FindBin qw( $Bin ); > $YAML::Syck::ImplicitTyping = 1; > > >+# Default file header for .po syspref files >+my $default_pref_po_header = Locale::PO->new(-msgid => '', -msgstr => >+ "Project-Id-Version: PACKAGE VERSION\\n" . >+ "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\\n" . >+ "Last-Translator: FULL NAME <EMAIL\@ADDRESS>\\n" . >+ "Language-Team: Koha Translate List <koha-translate\@lists.koha-community.org>\\n" . >+ "MIME-Version: 1.0\\n" . >+ "Content-Type: text/plain; charset=UTF-8\\n" . >+ "Content-Transfer-Encoding: 8bit\\n" . >+ "Plural-Forms: nplurals=2; plural=(n > 1);\\n" >+); >+ >+ > sub set_lang { > my ($self, $lang) = @_; > >@@ -52,7 +65,7 @@ sub new { > $self->{verbose} = $verbose; > $self->{process} = "$Bin/tmpl_process3.pl " . ($verbose ? '' : '-q'); > $self->{path_po} = "$Bin/po"; >- $self->{po} = {}; >+ $self->{po} = { '' => $default_pref_po_header }; > > # Get all .pref file names > opendir my $fh, $self->{path_pref_en}; >@@ -222,8 +235,13 @@ sub get_po_from_prefs { > > sub save_po { > my $self = shift; >+ >+ # Create file header if it doesn't already exist >+ my $po = $self->{po}; >+ $po->{''} ||= $default_pref_po_header; >+ > # Write .po entries into a file put in Koha standard po directory >- Locale::PO->save_file_fromhash( $self->po_filename, $self->{po} ); >+ Locale::PO->save_file_fromhash( $self->po_filename, $po ); > say "Saved in file: ", $self->po_filename if $self->{verbose}; > } > >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10214
:
18132
|
18133
| 18142