Improve addTrEntry

Allow to set a key from another key
This commit is contained in:
Maxime Besson 2022-09-29 17:03:53 +02:00
parent ccb898f24a
commit 8da2666acc
1 changed files with 8 additions and 1 deletions

View File

@ -65,7 +65,13 @@ for my $lang (@langs) {
delete $jsonObj->{$key};
}
else {
$jsonObj->{$key} = ( $lang eq 'fr.json' ? $frText : $enText );
my $text = ($lang eq 'fr.json' ? $frText : $enText);
if ($text =~ /^\$(.*)/) {
die "\$$1 not found" unless $jsonObj->{$1};
$jsonObj->{$key} = $jsonObj->{$1};
} else {
$jsonObj->{$key} = $text;
}
}
}
$content = $json->encode($jsonObj);
@ -81,6 +87,7 @@ sub usage {
print STDERR <<EOT;
Usage:
$0 <option> key enText <frText>
$0 <option> key '\$otherkey'
Options:
--portal -p: add entry in portal translation instead of manager