add transifex translation script
This commit is contained in:
parent
de7eeafe5d
commit
e7829a62f3
8
.tx/config
Normal file
8
.tx/config
Normal file
@ -0,0 +1,8 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[vanilla-music-1.en-strings]
|
||||
file_filter = translations/vanilla-music-1.en-strings/<lang>.xml
|
||||
source_lang = en
|
||||
type = ANDROID
|
||||
|
33
update-translations.pl
Executable file
33
update-translations.pl
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
|
||||
# nasty mapping table
|
||||
my $LMAP = {
|
||||
'el' => 'el-rGR',
|
||||
'fa_IR' => 'fa-rIR',
|
||||
'sr' => 'sr-rRS',
|
||||
'zh_CN' => 'zh-rCN',
|
||||
'zh_TW' => 'zh-rTW',
|
||||
'hu_HU' => 'hu',
|
||||
'it_IT' => 'it',
|
||||
'pl_PL' => 'pl',
|
||||
'id' => 'in',
|
||||
};
|
||||
|
||||
|
||||
die "Stale 'translations'-dir exists\n" if -d 'translations';
|
||||
system("tx pull -a --minimum-perc=30");
|
||||
|
||||
foreach my $src_file (glob("translations/vanilla-music-1.en-strings/*.xml")) {
|
||||
if ($src_file =~ /\/([a-zA-Z_]+)\.xml/) {
|
||||
my $locale = $1;
|
||||
$locale = $LMAP->{$locale} if exists $LMAP->{$locale};
|
||||
my $dst_file = "res/values-$locale/translatable.xml";
|
||||
|
||||
warn "+ $src_file -> $dst_file\n";
|
||||
die "Unknown locale: '$locale', target=$dst_file\n" unless -f $dst_file;
|
||||
rename($src_file, $dst_file) or die "rename failed: $!\n";
|
||||
}
|
||||
}
|
||||
|
||||
system("rm -rf translations");
|
Loading…
x
Reference in New Issue
Block a user