Bugzilla – Attachment 15207 Details for
Bug 9161
Translate only specific files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Signed-off patch (merged follow-up)
0001-Bug-9161-Followup-the-f-param-does-not-work-correctl.patch (text/plain), 5.32 KB, created by
Frédéric Demians
on 2013-02-10 07:29:47 UTC
(
hide
)
Description:
Signed-off patch (merged follow-up)
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2013-02-10 07:29:47 UTC
Size:
5.32 KB
patch
obsolete
>From 305f0590f63f06703b784f747e6e4f8495b8788c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 29 Jan 2013 14:27:42 +0100 >Subject: [PATCH] Bug 9161: Followup: the -f param does not work correctly >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Without this patch, the -f param (for the translate script) add the >modified line in the po file BUT comment all lines from others files. > >This patch concat the generated file with the previous one and merge >them. This way produce a pretty po file with all our strings :) > >+ Modification in LangInstaller.pm to fix a bug when the -f param was not >given. > >Test plan: >1/ Update your po file : >cd misc/translator >perl translate update fr-FR >git commit -a -m"TMP PO" >2/ Modification on 2 files: >ie. >catalogue/advsearch.tt:32 <h1>Advanced search Foo</h1> >catalogue/issuehistory.tt:38 <th>Patron Bar</th> > >3/ Update your po file with only the first file: >perl translate update fr-FR -f advsearch.tt > >4/ Edit your po file and check that only the foo string is present (or >git diff). > >5/ Update your po file with only the second file: >perl translate update fr-FR -f issuehistory > >6/ Edit your po file and check that 2 strings are present (or git diff). > >7/ Change the translation for these 2 strings and delete the fuzzy >lines. > >8/ Install the first file for your language: >perl translate install fr-FR -f advsearch.tt > >9/ Edit your translated file and verify the string is translated. Check >that the issuehistory.tt file is not changed. > >10/ Same for issuehistory: >perl translate install fr-FR -f issuehistory > >11/ stash your modification in your tt files (or reset --hard): >git stash > >12/ Check in your po file that the 2 strings are commented (git diff). > >13/ To finish, install all template files and check that they are >replaced correctly: >perl translate install fr-FR > >Signed-off-by: Frédéric Demians <f.demians@tamil.fr> > >I have squashed the both follow-up patches. >--- > misc/translator/LangInstaller.pm | 6 +++--- > misc/translator/tmpl_process3.pl | 21 ++++++++++++++------- > 2 files changed, 17 insertions(+), 10 deletions(-) > >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 18f74ff..78bd812 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -320,7 +320,7 @@ sub install_tmpl { > "-o $trans->{dir}/$self->{lang} ". > "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . > ( >- $files >+ @$files > ? '-f ' . join ' -f ', @$files > : '' > ) >@@ -345,7 +345,7 @@ sub update_tmpl { > "-i $trans->{dir}/en/ " . > "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . > ( >- $files >+ @$files > ? '-f ' . join ' -f ', @$files > : '' > ) >@@ -380,7 +380,7 @@ sub create_tmpl { > "-i $trans->{dir}/en/ " . > "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . > ( >- $files >+ @$files > ? '-f ' . join ' -f ', @$files > : '' > ) >diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl >index f82dab9..fd31f73 100755 >--- a/misc/translator/tmpl_process3.pl >+++ b/misc/translator/tmpl_process3.pl >@@ -146,7 +146,7 @@ sub listfiles { > } elsif (-f $path) { > my $basename = basename $path; > push @it, $path >- if ( not @$filenames or ( grep { $basename =~ /$_/ } @$filenames ) ) >+ if ( not @$filenames or ( grep { $path =~ /$_/ } @$filenames ) ) > and (!defined $type || $dirent =~ /\.(?:$type)$/) || $action eq 'install'; > } elsif (-d $path && $recursive_p) { > push @it, listfiles($path, $type, $action, $filenames); >@@ -371,13 +371,20 @@ if ($action eq 'create') { > (defined $charset_in? ('-I', $charset_in): ()), > (defined $charset_out? ('-O', $charset_out): ())); > if ($st == 0) { >- # Merge the temporary "pot file" with the specified po file ($str_file) >- # FIXME: msgmerge(1) is a Unix dependency >- # FIXME: need to check the return value >- $st = system("msgmerge -U ".($quiet?'-q':'')." -s $str_file $tmpfile2"); >+ # Merge the temporary "pot file" with the specified po file ($str_file) >+ # FIXME: msgmerge(1) is a Unix dependency >+ # FIXME: need to check the return value >+ if ( @filenames ) { >+ my ($tmph3, $tmpfile3) = tmpnam(); >+ $st = system("msgcat $str_file $tmpfile2 > $tmpfile3"); >+ $st = system("msgmerge -U ".($quiet?'-q':'')." -s $str_file $tmpfile3") >+ unless $st; >+ } else { >+ $st = system("msgmerge -U ".($quiet?'-q':'')." -s $str_file $tmpfile2"); >+ } > } else { >- error_normal "Text extraction failed: $xgettext: $!\n", undef; >- error_additional "Will not run msgmerge\n", undef; >+ error_normal "Text extraction failed: $xgettext: $!\n", undef; >+ error_additional "Will not run msgmerge\n", undef; > } > # unlink $tmpfile1 || warn_normal "$tmpfile1: unlink failed: $!\n", undef; > # unlink $tmpfile2 || warn_normal "$tmpfile2: unlink failed: $!\n", undef; >-- >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 9161
:
13728
|
13729
|
13731
|
14208
|
14914
|
14997
|
15207
|
18362
|
18363