Bugzilla – Attachment 106807 Details for
Bug 25067
Move PO file manipulation code into gulp tasks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25067: Do not set msgctxt in pref PO files
Bug-25067-Do-not-set-msgctxt-in-pref-PO-files.patch (text/plain), 2.79 KB, created by
Julian Maurice
on 2020-07-12 17:05:40 UTC
(
hide
)
Description:
Bug 25067: Do not set msgctxt in pref PO files
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-07-12 17:05:40 UTC
Size:
2.79 KB
patch
obsolete
>From 64d095b9806f23130b32cefd23162ae679a3c011 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Sun, 12 Jul 2020 21:01:14 +0400 >Subject: [PATCH] Bug 25067: Do not set msgctxt in pref PO files > >By having msgctxt set, msgmerge will "lose" some translations, forcing >translators to re-translate them. >Also, Pootle does not offer the ability to search by context, making it >harder to translate all strings related to a single preference. >--- > misc/translator/xgettext-pref | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > >diff --git a/misc/translator/xgettext-pref b/misc/translator/xgettext-pref >index 7ddbc883fe..1113a27f95 100755 >--- a/misc/translator/xgettext-pref >+++ b/misc/translator/xgettext-pref >@@ -45,6 +45,7 @@ display this help and exit > > use Modern::Perl; > >+use File::Basename; > use Getopt::Long; > use Locale::PO; > use Pod::Usage; >@@ -90,14 +91,15 @@ my $pot = { > for my $file (@files) { > my $pref = LoadFile($file); > while ( my ($tab, $tab_content) = each %$pref ) { >- add_po($file, undef, $tab); >+ add_po(undef, basename($file)); > > if ( ref($tab_content) eq 'ARRAY' ) { > add_prefs( $file, $tab, $tab_content ); > } else { > while ( my ($section, $sysprefs) = each %$tab_content ) { > my $context = "$tab > $section"; >- add_po($file, $tab, $section); >+ my $msgid = sprintf('%s %s', basename($file), $section); >+ add_po($tab, $msgid); > add_prefs( $file, $context, $sysprefs ); > } > } >@@ -123,26 +125,26 @@ sub add_prefs { > next unless $key eq 'choices' or $key eq 'multiple'; > next unless ref($value) eq 'HASH'; > for my $ckey ( keys %$value ) { >- add_po( $file, "$context > $pref_name", $value->{$ckey} ); >+ my $msgid = sprintf('%s#%s# %s', basename($file), $pref_name, $value->{$ckey}); >+ add_po( "$context > $pref_name", $msgid ); > } > } > } > elsif ($element) { >- add_po( $file, "$context > $pref_name", $element ); >+ my $msgid = sprintf('%s#%s# %s', basename($file), $pref_name, $element); >+ add_po( "$context > $pref_name", $msgid ); > } > } > } > } > > sub add_po { >- my ( $reference, $msgctxt, $msgid ) = @_; >+ my ($comment, $msgid ) = @_; > > return unless $msgid; > >- my $key = ($msgctxt // '') . ";$msgid"; >- $pot->{$key} = Locale::PO->new( >- -reference => $reference, >- -msgctxt => $msgctxt, >+ $pot->{$msgid} = Locale::PO->new( >+ -comment => $comment, > -msgid => $msgid, > -msgstr => '', > ); >-- >2.20.1
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 25067
:
102432
|
103383
|
103403
|
103404
|
103440
|
103557
|
103558
|
103562
|
103563
|
103564
|
103565
|
103566
|
106503
|
106504
|
106505
|
106506
|
106507
|
106807
|
109272
|
109273
|
109274
|
109275
|
109276
|
109277
|
109295
|
109296
|
109297
|
110011
|
110012
|
110013
|
110014
|
110015
|
110016
|
110017
|
110018
|
110019
|
110776
|
111642
|
111643
|
113252
|
113255
|
113258