[otrs-cvs] otrs/bin otrs.CreateTranslationFile.pl,1.34,1.35
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/bin
In directory lancelot:/tmp/cvs-serv31914/bin
Modified Files:
otrs.CreateTranslationFile.pl
Log Message:
Removed obsolete translation entries, just once for 3.2.
Author: mg
Index: otrs.CreateTranslationFile.pl
===================================================================
RCS file: /home/cvs/otrs/bin/otrs.CreateTranslationFile.pl,v
retrieving revision 1.34
retrieving revision 1.35
diff -2 -u -d -r1.34 -r1.35
--- otrs.CreateTranslationFile.pl 20 Nov 2012 16:03:18 -0000 1.34
+++ otrs.CreateTranslationFile.pl 22 Nov 2012 12:33:58 -0000 1.35
@@ -70,4 +70,11 @@
otrs.CreateTranslationFile -l all -m <module_directory>
+Optional Parameters
+=============================
+
+ To purge obsolete translation entries, use -p
+
+ otrs.CreateTranslationFile -l all -p
+
EOF
}
@@ -95,5 +102,5 @@
# get opts
- Getopt::Std::getopt( 'lm', \%Opts );
+ Getopt::Std::getopt( 'lmp', \%Opts );
# check params
@@ -121,6 +128,7 @@
for my $Language (@Languages) {
HandleLanguage(
- Language => $Language,
- Module => $Opts{m},
+ Language => $Language,
+ Module => $Opts{m},
+ PurgeObsolete => exists $Opts{p} ? 1 : 0,
);
}
@@ -132,6 +140,7 @@
my (%Param) = @_;
- my $Language = $Param{Language};
- my $Module = $Param{Module};
+ my $Language = $Param{Language};
+ my $Module = $Param{Module};
+ my $PurgeObsolete = $Param{PurgeObsolete};
my $ModuleDirectory = $Module;
@@ -369,41 +378,43 @@
$Data .= $Indent . "#\n";
- KEY:
- for my $Key ( sort keys %{ $LanguageObject->{Translation} } ) {
+ if ( !$PurgeObsolete ) {
+ KEY:
+ for my $Key ( sort keys %{ $LanguageObject->{Translation} } ) {
- # ignore words from the core if we are translating a module
- next KEY if $IsSubTranslation && exists $LanguageCoreObject->{Translation}->{$Key};
+ # ignore words from the core if we are translating a module
+ next KEY if $IsSubTranslation && exists $LanguageCoreObject->{Translation}->{$Key};
- # ignore word if already used
- next KEY if $UsedWordsMisc{$Key};
+ # ignore word if already used
+ next KEY if $UsedWordsMisc{$Key};
- my $Translation = $LanguageObject->{Translation}->{$Key};
- $Translation =~ s/'/\\'/g;
- $Key =~ s/'/\\'/g;
+ my $Translation = $LanguageObject->{Translation}->{$Key};
+ $Translation =~ s/'/\\'/g;
+ $Key =~ s/'/\\'/g;
- # if a string was previously in a DTL, but has not yet been translated,
- # there's no need to preserve it in the translation file.
- next KEY if !$Translation;
+ # if a string was previously in a DTL, but has not yet been translated,
+ # there's no need to preserve it in the translation file.
+ next KEY if !$Translation;
- # TODO: clarify if regular expression check is still needed
- # in the past it was used to guard against wrong matches
- next KEY if $Key =~ /(a href|\$(Text|Quote)\{")/i;
+ # TODO: clarify if regular expression check is still needed
+ # in the past it was used to guard against wrong matches
+ next KEY if $Key =~ /(a href|\$(Text|Quote)\{")/i;
- if ($IsSubTranslation) {
- if ( length($Key) < $BreakLineAfterChars ) {
- $Data .= $Indent . "\$Self->{Translation}->{'$Key'} = '$Translation';\n";
- }
- else {
- $Data .= $Indent . "\$Self->{Translation}->{'$Key'} =\n";
- $Data .= $Indent . ' ' . "'$Translation';\n";
- }
- }
- else {
- if ( length($Key) < $BreakLineAfterChars ) {
- $Data .= $Indent . "'$Key' => '$Translation',\n";
+ if ($IsSubTranslation) {
+ if ( length($Key) < $BreakLineAfterChars ) {
+ $Data .= $Indent . "\$Self->{Translation}->{'$Key'} = '$Translation';\n";
+ }
+ else {
+ $Data .= $Indent . "\$Self->{Translation}->{'$Key'} =\n";
+ $Data .= $Indent . ' ' . "'$Translation';\n";
+ }
}
else {
- $Data .= $Indent . "'$Key' =>\n";
- $Data .= $Indent . ' ' . "'$Translation',\n";
+ if ( length($Key) < $BreakLineAfterChars ) {
+ $Data .= $Indent . "'$Key' => '$Translation',\n";
+ }
+ else {
+ $Data .= $Indent . "'$Key' =>\n";
+ $Data .= $Indent . ' ' . "'$Translation',\n";
+ }
}
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log