Bugzilla – Attachment 11693 Details for
Bug 8044
Localization for Perl scripts and modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8044 follow-up: Fix warning and error messages in translate.pl
0002-Bug-8044-follow-up-Fix-warning-and-error-messages-in.patch (text/plain), 3.04 KB, created by
Julian Maurice
on 2012-08-20 10:06:00 UTC
(
hide
)
Description:
Bug 8044 follow-up: Fix warning and error messages in translate.pl
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-08-20 10:06:00 UTC
Size:
3.04 KB
patch
obsolete
>From 43d820cb52caa45edbf7ec11e102af29bd0e991f Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 20 Aug 2012 10:55:50 +0200 >Subject: [PATCH 2/3] Bug 8044 follow-up: Fix warning and error messages in > translate.pl > >CHARSET is now automatically replaced by UTF-8, and 'update' create the >PO file if it does not exist. > >+ add some verbosity >+ add Locale::Maketext and Locale::Maketext::Lexicon to Koha >dependencies >--- > C4/Installer/PerlDependencies.pm | 10 ++++++++++ > misc/translator/LangInstaller.pm | 22 ++++++++++++++++++---- > 2 files changed, 28 insertions(+), 4 deletions(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index a9c68a8..a44b4b8 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -590,6 +590,16 @@ our $PERL_DEPS = { > 'required' => '1', > 'min_ver' => '1.23', > }, >+ 'Locale::Maketext' => { >+ 'usage' => 'Core', >+ 'required' => '1', >+ 'min_ver' => '1.19', >+ }, >+ 'Locale::Maketext::Lexicon' => { >+ 'usage' => 'Core', >+ 'required' => '1', >+ 'min_ver' => '0.91', >+ }, > }; > > 1; >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 0cb8de2..7ccf5aa 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -57,9 +57,11 @@ sub new { > $self->{cp} = `which cp`; > $self->{msgmerge} = `which msgmerge`; > $self->{xgettext} = `which xgettext`; >+ $self->{sed} = `which sed`; > chomp $self->{cp}; > chomp $self->{msgmerge}; > chomp $self->{xgettext}; >+ chomp $self->{sed}; > > # Get all .pref file names > opendir my $fh, $self->{path_pref_en}; >@@ -365,6 +367,7 @@ sub create_tmpl { > sub create_messages { > my $self = shift; > >+ print "Create messages ($self->{lang})\n" if $self->{verbose}; > system > "$self->{cp} $self->{domain}.pot " . > "$self->{path_po}/$self->{lang}-$self->{domain}.po"; >@@ -373,10 +376,14 @@ sub create_messages { > sub update_messages { > my $self = shift; > >- system >- "$self->{msgmerge} -U " . >- "$self->{path_po}/$self->{lang}-$self->{domain}.po " . >- "$self->{domain}.pot"; >+ my $pofile = "$self->{path_po}/$self->{lang}-$self->{domain}.po"; >+ print "Update messages ($self->{lang})\n" if $self->{verbose}; >+ if ( not -f $pofile ) { >+ print "File $pofile does not exist\n" if $self->{verbose}; >+ $self->create_messages(); >+ } >+ system "$self->{msgmerge} -U $pofile $self->{domain}.pot"; >+ > } > > sub extract_messages { >@@ -408,6 +415,13 @@ sub extract_messages { > if (system($xgettext_cmd) != 0) { > die "system call failed: $xgettext_cmd"; > } >+ >+ my $replace_charset_cmd = "$self->{sed} --in-place " . >+ "$Bin/$self->{domain}.pot " . >+ "--expression='s/charset=CHARSET/charset=UTF-8/'"; >+ if (system($replace_charset_cmd) != 0) { >+ die "system call failed: $replace_charset_cmd"; >+ } > } > > sub remove_pot { >-- >1.7.10.4 >
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 8044
:
9415
|
9416
|
9427
|
9449
|
9910
|
9911
|
11689
|
11690
|
11691
|
11693
|
11694
|
11695
|
11696
|
11697
|
13218
|
13219
|
13220
|
13221
|
17711
|
17712
|
17713
|
17714
|
19100
|
19101
|
19102
|
19103
|
20366
|
20367
|
20368
|
20369
|
20370
|
25964
|
25965
|
25966
|
25967