Bugzilla – Attachment 23358 Details for
Bug 7934
Separate po file for help pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF]Bug 7934 - Separate po file for help pages
Bug-7934---Separate-po-file-for-help-pages.patch (text/plain), 6.20 KB, created by
Fridolin Somers
on 2013-12-09 16:32:32 UTC
(
hide
)
Description:
[SIGNED-OFF]Bug 7934 - Separate po file for help pages
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-12-09 16:32:32 UTC
Size:
6.20 KB
patch
obsolete
>From 53ddddb3276c4e331ef61bb7bc77892f6ca2cb7f Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Wed, 4 Dec 2013 20:44:36 -0300 >Subject: [PATCH] Bug 7934 - Separate po file for help pages >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch modifies LangInstaller.pm to enable separation >of translation for Staff UI and Staff Help files. > >It's a move that make sense, Help strings accounts for >44% of total word count for Staff, and as stated on >Comment #1, it could enable a different workflow on >translation work. > >It's more a hack than an elegant solution, but it works. >Feel free to suggest another approach. > >To test: > >We need to test complete functionality, i.e. create and update >translation files and install translation, and verify that no >string is missing. > >1) Before applying the patch, we need some data from staff file. >Pick your language, say de_DE, and > >cd misc/translator/ >perl translate update de-DE >msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-old.po --no-translator --no-wrap --locale=de_DE >egrep ^msgid de-old.po | sort | tee s-old | wc -l > number-old > >We have the file s-old with all strings, and the number of strings on number-old > >2) Apply the patch > >3) New help file is called de-DE-staff-help.po, so create one >cp'ing old staff on new help > >cp po/de-DE-i-staff-t-prog-v-3006000.po po/de-DE-staff-help.po > >4) Make a new update, and analize > >perl translate update de-DE >msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-new.po --no-translator --no-wrap --locale=de_DE >msginit -i po/de-DE-staff-help.po -o de-help.po --no-translator --no-wrap --locale=de_DE >egrep ^msgid de-new.po | sort | tee s-new | wc -l > number-new >egrep ^msgid de-help.po | sort | tee s-help | wc -l > number-help >cat s-new s-help | sort | uniq | tee s-all | wc -l > number-all >cat s-new s-help | sort | uniq -d | tee s-dup | wc -l > number-dup > >Ideally what we need to found is: > >diff s-old s-all = zero lines (old strings vs new strings) > >In my test I got one line, but it's a false positive (the string "ΓΆΒΆ " is present on new staff) > >On numbers, > >number-old - number-new - nummber-help + number-dup = 0 >or >number-old - number-all = 0 > >(in my test again I have 1 as result, same string. Also there are 137 >repeated lines between new staff and help) > >All this tells me that all string to translate are preserved > >5) Install translation > >perl translate install de-DE > >Enable language on staff, and check that help files are translated > >6) Finally, create translation files > >rm po/de-DE-* >perl translate create de-DE > >verify that all files are created. Tests of 4) can be repeated. > >7) Verify that no strings from help are present on staff UI file > >egrep help po/de-DE-i-staff-t-prog-v-3006000.po > >Only results came from help-top and bottom, and a few "help" on staff strings > >Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >--- > misc/translator/LangInstaller.pm | 36 +++++++++++++++++++++++++++--------- > 1 file changed, 27 insertions(+), 9 deletions(-) > >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index f3525f8..50ba308 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -89,10 +89,15 @@ sub new { > suffix => '-i-opac-t-prog-v-3006000.po', > }, > { >- name => 'Intranet prog', >+ name => 'Intranet prog UI', > dir => $context->config('intrahtdocs') . '/prog', > suffix => '-i-staff-t-prog-v-3006000.po', > }, >+ { >+ name => 'Intranet prog help', >+ dir => $context->config('intrahtdocs') . '/prog/en/modules/help', >+ suffix => '-staff-help.po', >+ }, > ]; > > # Alternate opac themes >@@ -330,13 +335,18 @@ sub install_tmpl { > " To : $trans->{dir}/$self->{lang}\n", > " With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" > if $self->{verbose}; >- my $lang_dir = "$trans->{dir}/$self->{lang}"; >+ >+ my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; >+ my $lang_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/$self->{lang}"; >+ $lang_dir =~ s|/en/|/$self->{lang}/|; > mkdir $lang_dir unless -d $lang_dir; >+ my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; >+ > system > "$self->{process} install " . >- "-i $trans->{dir}/en/ " . >- "-o $trans->{dir}/$self->{lang} ". >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ "-i $trans_dir " . >+ "-o $lang_dir ". >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . > ( > @$files > ? '-f ' . join ' -f ', @$files >@@ -358,10 +368,14 @@ sub update_tmpl { > if $self->{verbose}; > my $lang_dir = "$trans->{dir}/$self->{lang}"; > mkdir $lang_dir unless -d $lang_dir; >+ >+ my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; >+ my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; >+ > system > "$self->{process} update " . >- "-i $trans->{dir}/en/ " . >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ "-i $trans_dir " . >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . > ( > @$files > ? '-f ' . join ' -f ', @$files >@@ -393,10 +407,14 @@ sub create_tmpl { > " From: $trans->{dir}/en/\n", > " To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" > if $self->{verbose}; >+ >+ my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; >+ my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; >+ > system > "$self->{process} create " . >- "-i $trans->{dir}/en/ " . >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ "-i $trans_dir " . >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . > ( > @$files > ? '-f ' . join ' -f ', @$files >-- >1.8.3.2
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 7934
:
23314
|
23358
|
23556