Bugzilla – Attachment 13731 Details for
Bug 9161
Translate only specific files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9161: Followup: Add a -f param for the translate script
Bug-9161-Followup-Add-a--f-param-for-the-translate.patch (text/plain), 4.30 KB, created by
Jonathan Druart
on 2012-11-28 11:21:07 UTC
(
hide
)
Description:
Bug 9161: Followup: Add a -f param for the translate script
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-11-28 11:21:07 UTC
Size:
4.30 KB
patch
obsolete
>From 4576c39e994befd6e343e3b695f3e2c22c7eadcf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 28 Nov 2012 12:18:59 +0100 >Subject: [PATCH] Bug 9161: Followup: Add a -f param for the translate script > >Now you can directly call the translate script >(misc/translator/translate) with the -f parameter > >eg.: >./translate install|create|update -f search.tt -f main.tt >--- > misc/translator/LangInstaller.pm | 39 ++++++++++++++++++++++++++------------ > misc/translator/translate | 6 ++++-- > 2 files changed, 31 insertions(+), 14 deletions(-) > >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 00daaf4..18f74ff 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -303,7 +303,7 @@ sub install_prefs { > > > sub install_tmpl { >- my $self = shift; >+ my ($self, $files) = @_; > say "Install templates" if $self->{verbose}; > for my $trans ( @{$self->{interface}} ) { > print >@@ -318,13 +318,18 @@ sub install_tmpl { > "$self->{process} install " . > "-i $trans->{dir}/en/ " . > "-o $trans->{dir}/$self->{lang} ". >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r" >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ ( >+ $files >+ ? '-f ' . join ' -f ', @$files >+ : '' >+ ) > } > } > > > sub update_tmpl { >- my $self = shift; >+ my ($self, $files) = @_; > > say "Update templates" if $self->{verbose}; > for my $trans ( @{$self->{interface}} ) { >@@ -338,7 +343,12 @@ sub update_tmpl { > system > "$self->{process} update " . > "-i $trans->{dir}/en/ " . >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r" >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ ( >+ $files >+ ? '-f ' . join ' -f ', @$files >+ : '' >+ ) > } > } > >@@ -356,7 +366,7 @@ sub create_prefs { > > > sub create_tmpl { >- my $self = shift; >+ my ($self, $files) = @_; > > say "Create templates\n" if $self->{verbose}; > for my $trans ( @{$self->{interface}} ) { >@@ -368,15 +378,20 @@ sub create_tmpl { > system > "$self->{process} create " . > "-i $trans->{dir}/en/ " . >- "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r" >+ "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . >+ ( >+ $files >+ ? '-f ' . join ' -f ', @$files >+ : '' >+ ) > } > } > > > sub install { >- my $self = shift; >+ my ($self, $files) = @_; > return unless $self->{lang}; >- $self->install_tmpl() unless $self->{pref_only}; >+ $self->install_tmpl($files) unless $self->{pref_only}; > $self->install_prefs(); > } > >@@ -391,20 +406,20 @@ sub get_all_langs { > > > sub update { >- my $self = shift; >+ my ($self, $files) = @_; > my @langs = $self->{lang} ? ($self->{lang}) : $self->get_all_langs(); > for my $lang ( @langs ) { > $self->set_lang( $lang ); >- $self->update_tmpl() unless $self->{pref_only}; >+ $self->update_tmpl($files) unless $self->{pref_only}; > $self->update_prefs(); > } > } > > > sub create { >- my $self = shift; >+ my ($self, $files) = @_; > return unless $self->{lang}; >- $self->create_tmpl() unless $self->{pref_only}; >+ $self->create_tmpl($files) unless $self->{pref_only}; > $self->create_prefs(); > } > >diff --git a/misc/translator/translate b/misc/translator/translate >index f0c12c9..4beffa3 100755 >--- a/misc/translator/translate >+++ b/misc/translator/translate >@@ -30,9 +30,11 @@ use Pod::Usage; > my $verbose = 0; > my $pref = 0; > my $all = 0; >+my @files; > GetOptions( > 'v|verbose' => \$verbose, > 'p' => \$pref, >+ 'f:s' => \@files, > 'a|all' => \$all, > ); > >@@ -57,11 +59,11 @@ if ( $cmd =~ /create|install|update/ ) { > usage() if $cmd eq 'create'; > for my $lang ( @{$installer->{langs}} ) { > $installer->set_lang( $lang ); >- $installer->$cmd(); >+ $installer->$cmd(\@files); > } > } > else { >- $installer->$cmd(); >+ $installer->$cmd(\@files); > } > } > else { >-- >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 9161
:
13728
|
13729
|
13731
|
14208
|
14914
|
14997
|
15207
|
18362
|
18363