Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools/create_nsis_translations.pl
blob: cac80b6f581ef003bf0057bc2276ba2200f64a66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl

# You must 'cd' to the top directory of GCompris before you run it

use strict;

my $gcompris_root_dir = ".";
my $ALL_LINGUAS_STR   = `grep "ALL_LINGUAS=" $gcompris_root_dir/configure.in | cut -d= -f2`;
$ALL_LINGUAS_STR      =~ s/\"//g;
my @ALL_LINGUAS       = split(' ', $ALL_LINGUAS_STR);

my %localeNames = (
  "af", "Afrikaans",
  "am", "Amharic",
  "ar", "Arabic",
  "az", "Turkish",
  "bg",	"Bulgarian",
  "br",	"Breton",
  "ca",	"Catalan",
  "cs",	"Czech",
  "da", "Danish",
  "de", "German",
  "dz",	"Dzongkha",
  "el", "Greek",
  "es", "Spanish",
  "eu",	"Basque",
  "fa", "Persian",
  "fi", "Finnish",
  "fr", "French",
  "ga", "Irish",
  "gu",	"Gujarati",
  "he",	"Hebrew",
  "hi",	"Hindi",
  "hr",	"Croatian",
  "hu",	"Hungarian",
  "id",	"Indonesian",
  "it", "Italian",
  "ja",	"Japanese",
  "ka", "Georgian",
  "ko", "Korean",
  "lt",	"Lithuanian",
  "mk",	"Macedonian",
  "ml",	"Malayalam",
  "mr",	"Marathi",
  "ms",	"Malay",
  "nb",	"Norwegian Bokmal",
  "ne",	"Nepal",
  "nl",	"Dutch",
  "nn",	"Norwegian Nynorsk",
  "oc",	"Occitan",
  "pa",	"Punjabi",
  "pl",	"Polish",
  "pt",	"Portuguese",
  "pt_BR", "PortugueseBR",
  "ro",	"Romanian",
  "ru",	"Russian",
  "rw",	"Kinyarwanda",
  "sk",	"Slovak",
  "sl",	"Slovenian",
  "so",	"Somali",
  "sq",	"Albanian",
  "sr",	"Serbian",
  "sv",	"Swedish",
  "ta",	"Tamil",
  "th",	"Thai",
  "tr",	"Turkish",
  "uk", "Ukrainian",
  "ur",	"Urdu",
  "vi",	"Vietnamese",
  "wa",	"Walloon",
  "zh",	"SimpChinese",
  "zh", "TradChinese"
);

my @localeKeys = keys(%localeNames);

# Lets insert the default languages
# in the installer file which means replacing:
#   @INSERTMACRO_MUI_LANGUAGE@
# By the list of locales:
#   !insertmacro MUI_LANGUAGE "French"

my $muiLanguages;
foreach my $lang (@localeKeys) {
    $muiLanguages .= "  !insertmacro MUI_LANGUAGE \"$localeNames{$lang}\"\n";
}

print $muiLanguages;

# The specific GCompris translation for the installer
# replacing:
#   @GCOMPRIS_MACRO_INCLUDE_LANGFILE@
# By the list of locales:
#   !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ALBANIAN" "${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\albanian.nsh"

my $gcomprisLanguages;
foreach my $lang (@localeKeys) {
    $gcomprisLanguages .= "  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE".
     " \"$localeNames{$lang}\"".
     "\"\${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\$lang.nsh\"\n";
}

print $gcomprisLanguages;

# Create each nsh translation file

foreach my $lang (@localeKeys) {
    open (DESC, ">nsis/tt/$lang.nsh");
    print DESC ";; Auto generated file by create_nsis_translations.pl\n";

    # Extract the string to translate from the nsis_translations file
    my @text = `grep "\\\[$lang\\\]" $gcompris_root_dir/nsis_translations.desktop`;

    foreach my $line (@text) {
        chomp $line;
        my @keyval = split("=", $line);
        print DESC "@keyval[0]=\"@keyval[1]\"\n";
    }
    close DESC;
}