diff --git a/.tx/config b/.tx/config new file mode 100644 index 00000000..816fb3ca --- /dev/null +++ b/.tx/config @@ -0,0 +1,8 @@ +[main] +host = https://www.transifex.com + +[vanilla-music-1.en-strings] +file_filter = translations/vanilla-music-1.en-strings/.xml +source_lang = en +type = ANDROID + diff --git a/update-translations.pl b/update-translations.pl new file mode 100755 index 00000000..1d94c2e2 --- /dev/null +++ b/update-translations.pl @@ -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");