Skip to content

Commit 9dbff38

Browse files
author
Igor Afanasyev
committed
Support --lang parameter in serge pull-ts and serge push-ts
1 parent 0577f7a commit 9dbff38

File tree

8 files changed

+36
-7
lines changed

8 files changed

+36
-7
lines changed

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ Revision history
22

33
1.4 Pending release
44

5+
- Support `--lang` parameter in `serge pull-ts` and `serge push-ts`
6+
(gives an ability to specify one or more languages which should be
7+
synchronized with the translation service). Previously this parameter
8+
worked only for `serge sync` and `serge localize` and only affected
9+
the localization step.
10+
511
1.3 February 1, 2018
612

713
- Fix bug when extra item comment would be appended only if the

doc/html/serge-pull-ts.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ <h1 id="OPTIONS">OPTIONS</h1>
4141

4242
<p>Instruct the remote party to skip any optimizations and force update all translation files.</p>
4343

44+
</dd>
45+
<dt><b>--lang=xx[,yy][,zz]</b>, <b>--language=xx[,yy][,zz]</b> <b>--languages=xx[,yy][,zz]</b></dt>
46+
<dd>
47+
48+
<p>See <code><a href="serge-localize.html">serge localize --lang</a></code>. Will also completely skip processing configs where no target languages are found.</p>
49+
4450
</dd>
4551
<dt><b>--echo-commands</b></dt>
4652
<dd>

doc/html/serge-push-ts.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ <h1 id="OPTIONS">OPTIONS</h1>
4141

4242
<p>Instruct the remote party to skip any optimizations and force update data from all translation files.</p>
4343

44+
</dd>
45+
<dt><b>--lang=xx[,yy][,zz]</b>, <b>--language=xx[,yy][,zz]</b> <b>--languages=xx[,yy][,zz]</b></dt>
46+
<dd>
47+
48+
<p>See <code><a href="serge-localize.html">serge localize --lang</a></code>. Will also completely skip processing configs where no target languages are found.</p>
49+
4450
</dd>
4551
<dt><b>--echo-commands</b></dt>
4652
<dd>

doc/pod/serge-pull-ts.pod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ from remote translation server into the local directory.
2424

2525
Instruct the remote party to skip any optimizations and force update all translation files.
2626

27+
=item B<--lang=xx[,yy][,zz]>, B<--language=xx[,yy][,zz]> B<--languages=xx[,yy][,zz]>
28+
29+
See C<< L<serge localize --lang|serge-localize> >>.
30+
Will also completely skip processing configs where no target languages are found.
31+
2732
=item B<--echo-commands>
2833

2934
Echo system commands about to be executed (useful for debugging)

doc/pod/serge-push-ts.pod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ to remote translation server.
2525
Instruct the remote party to skip any optimizations
2626
and force update data from all translation files.
2727

28+
=item B<--lang=xx[,yy][,zz]>, B<--language=xx[,yy][,zz]> B<--languages=xx[,yy][,zz]>
29+
30+
See C<< L<serge localize --lang|serge-localize> >>.
31+
Will also completely skip processing configs where no target languages are found.
32+
2833
=item B<--echo-commands>
2934

3035
Echo system commands about to be executed (useful for debugging)

doc/pod/serge-sync.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ Has the same effect as C<< L<serge localize --output-only-mode|serge-localize> >
3636

3737
=item B<--lang=xx[,yy][,zz]>, B<--language=xx[,yy][,zz]> B<--languages=xx[,yy][,zz]>
3838

39-
See C<< L<serge localize --lang|serge-localize> >>. Will also completely skip processing configs where
40-
no target languages are found.
39+
See C<< L<serge localize --lang|serge-localize> >>.
40+
Will also completely skip processing configs where no target languages are found.
4141

4242
=item B<--job=xx[,yy][,zz]>, B<--jobs=xx[,yy][,zz]>
4343

44-
See C<< L<serge localize --job|serge-localize> >>. Will also completely skip processing configs where
45-
no target jobs are found.
44+
See C<< L<serge localize --job|serge-localize> >>.
45+
Will also completely skip processing configs where no target jobs are found.
4646

4747
=item B<--message="commit message">
4848

lib/Serge/Command/sync.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sub init {
3737
if ($command =~ m/^(pull-ts|localize|push-ts|sync)$/) {
3838
GetOptions(
3939
"force" => \$self->{force},
40+
"lang|language|languages=s" => \$self->{languages},
4041
) or die $error_msg;
4142
}
4243

@@ -55,7 +56,6 @@ sub init {
5556

5657
if ($command =~ m/^(localize|sync)$/) {
5758
GetOptions(
58-
"lang|language|languages=s" => \$self->{languages},
5959
"job|jobs=s" => \$self->{jobs},
6060
"rebuild-ts-files" => \$self->{rebuild_ts_files},
6161
"output-only-mode" => \$self->{output_only_mode},
@@ -89,6 +89,7 @@ sub run {
8989
my %limit_languages;
9090
if ($self->{languages}) {
9191
my @l = split(/,/, $self->{languages});
92+
$sync->{languages} = \@l;
9293
$engine->{limit_destination_languages} = \@l;
9394
@limit_languages{@l} = @l;
9495
}

lib/Serge/Sync.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ sub do_sync {
115115
} else {
116116
print "\nPulling translation files from external translation service...\n\n";
117117
my $start = [gettimeofday];
118-
$self->{ts}->pull_ts; # update all languages
118+
$self->{ts}->pull_ts($self->{languages}); # update all languages
119119
print "'pull-ts' step took ", tv_interval($start), " seconds\n";
120120
}
121121

@@ -142,7 +142,7 @@ sub do_sync {
142142
} else {
143143
print "\nPushing translation files to external translation service...\n\n";
144144
my $start = [gettimeofday];
145-
$self->{ts}->push_ts; # update all languages
145+
$self->{ts}->push_ts($self->{languages}); # update all languages
146146
print "'push-ts' step took ", tv_interval($start), " seconds\n";
147147
}
148148

0 commit comments

Comments
 (0)