diff options
author | Thierry Crozat | 2010-07-31 15:46:43 +0000 |
---|---|---|
committer | Thierry Crozat | 2010-07-31 15:46:43 +0000 |
commit | 1c6b339bbc2f9ee0624f7777e5950417a66a3286 (patch) | |
tree | 6ac38a5997bca3ec26bd831388cfac2f532ea54e /tools | |
parent | 5ea840283934938110f21fc04e3071b94c076765 (diff) | |
download | scummvm-rg350-1c6b339bbc2f9ee0624f7777e5950417a66a3286.tar.gz scummvm-rg350-1c6b339bbc2f9ee0624f7777e5950417a66a3286.tar.bz2 scummvm-rg350-1c6b339bbc2f9ee0624f7777e5950417a66a3286.zip |
i18n: use user friendly language names in GUI
The GUI now uses the content of the Language field from the po file
header if it is present and not empty for the language selection
PopupWidget. If not present it uses the file name as before (e.g.
ru_RU).
Also update all the translation template and all the translation files.
svn-id: r51542
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/po2c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/po2c b/tools/po2c index 9dbc5e0fb7..10e15338c7 100755 --- a/tools/po2c +++ b/tools/po2c @@ -161,19 +161,29 @@ foreach my $l (keys(%msgs)) print "struct PoLangEntry {\n"; print "\tconst char *lang;\n"; print "\tconst char *charset;\n"; +print "\tconst char *langname;\n"; print "\tconst PoMessageEntry *msgs;\n"; print "};\n\n"; print "const PoLangEntry _translations[] = {\n"; foreach my $l (keys(%msgs)) { + # charset $header = $msgs{$l}->{""}; $header =~ /charset=([^\\]+)/; $charset = $1; - print "\t{ \"" . $l . "\", \"" . $charset . "\", _translation_${l} },\n"; + # user readable language name + $lang = "NULL"; + $header = $msgs{$l}->{""}; + $header =~ /Language:[\s]*([^\\]*)/; + unless ($1 eq "") + { + $lang = "\"" . $1 . "\""; + } + print "\t{ \"" . $l . "\", \"" . $charset . "\", " . $lang . ", _translation_${l} },\n"; } -print "\t{ NULL, NULL, NULL }\n};\n\n"; +print "\t{ NULL, NULL, NULL, NULL }\n};\n\n"; print "// code\n"; print << 'EOF'; @@ -255,6 +265,13 @@ const char *po2c_getlang(const int num) { assert(num < ARRAYSIZE(_translations)); return _translations[num].lang; } + +const char *po2c_getlangname(const int num) { + assert(num < ARRAYSIZE(_translations)); + if (_translations[num].langname != NULL) + return _translations[num].langname; + return _translations[num].lang; +} EOF exit 0; |