Bugzilla – Attachment 18132 Details for
Bug 10214
malformed syspref.po file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-10214-Add-header-to-syspref-po-files.patch (text/plain), 2.70 KB, created by
Frédéric Demians
on 2013-05-14 11:30:19 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2013-05-14 11:30:19 UTC
Size:
2.70 KB
patch
obsolete
>From 2fdc32b890198bfced204fe3953028aa7ea8d32b 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] 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 >--- > misc/translator/LangInstaller.pm | 22 ++++++++++++++++++++-- > 1 files 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.2.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