annotate pidgin/win32/nsis/create_nsis_translations.pl @ 31574:f033f3c49a41

Requests are closed with the PurpleConnection, so there's no need for these checks here. Plus it seems like MsnSession is more useful in the callback than a PurpleConnection.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 10 Jan 2011 01:06:43 +0000
parents 62f0988c666c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
1 #!/usr/bin/perl
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
2 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
3 # create_nsis_translations.pl
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
4 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
5 # Copyright (C) 2000-2009 Bruno Coudoin
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
6 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
7 # This program is free software; you can redistribute it and/or modify
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
8 # it under the terms of the GNU General Public License as published by
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
9 # the Free Software Foundation; either version 3 of the License, or
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
10 # (at your option) any later version.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
11 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
15 # GNU General Public License for more details.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
16 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
18 # along with this program; if not, see <http://www.gnu.org/licenses/>.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
19 #
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
20
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
21 use strict;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
22
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
23 sub usage {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
24 print 'create_nsis_translations.pl translations installer tmp_dir
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
25 translations
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
26 This is an input file that contains all the
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
27 translated strings. If must be formated as a GNU/Linux
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
28 desktop file and contains multiple strings entry.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
29 For example you must have:
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
30 toBe=To be or not to be
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
31 toBe[fr]=Etre ou ne pas etre
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
32
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
33 installer
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
34 This is your nsis installer source file. You must include
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
35 in it the marker @INSERT_TRANSLATIONS@ before you use any
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
36 translation string.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
37 After that you can use the variable $(toBe) in your file.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
38
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
39 tmp_dir
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
40 This is a directory in which temporary files needed for
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 the translation system.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 It will be created if non existant.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43 You can remove it once you have created your installer.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 my $translations;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48 if (! $ARGV[0] || ! -f $ARGV[0])
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50 usage();
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
52 else
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
53 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
54 $translations = $ARGV[0];
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
55 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
56
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57 shift;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
58 my $installer;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
59 if (! $ARGV[0] || ! -f $ARGV[0])
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
61 usage();
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
62 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
63 else
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
64 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
65 $installer = $ARGV[0];
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
66 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
67
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
68 shift;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
69 my $tmp_dir;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
70 if (! $ARGV[0] )
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
71 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
72 usage();
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
73 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
74 else
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
75 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
76 $tmp_dir = $ARGV[0];
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
77
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
78 if ( ! -d $tmp_dir )
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
79 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
80 mkdir $tmp_dir or die "ERROR: '$tmp_dir' $!\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
81 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
82 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
83
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
84 print "Processing translation file '$translations'\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
85 print " NSIS source file '$installer'\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
86 print " Working dir '$tmp_dir'\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
87
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
88 # Commented out locales that are not available in nsis
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
89 # Map value is ["NSISFilename", "Encoding", "LCID"]
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
90 my %localeNames = (
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
91 "af" => ["Afrikaans", "WINDOWS-1252", "1078"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
92 # "am" => ["Amharic", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
93 "ar" => ["Arabic", "WINDOWS-1256", "1025"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
94 "be" => ["Belarusian", "WINDOWS-1251", "1059"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
95 "bg" => ["Bulgarian", "WINDOWS-1251", "1026"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
96 "bs" => ["Bosnian", "WINDOWS-1250", "5146"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
97 "br" => ["Breton", "WINDOWS-1252", "1150"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
98 "ca" => ["Catalan", "WINDOWS-1252", "1027"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
99 "cs" => ["Czech", "WINDOWS-1250", "1029"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
100 "cy" => ["Welsh", "WINDOWS-1252", "1160"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
101 "da" => ["Danish", "WINDOWS-1252", "1030"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
102 "de" => ["German", "WINDOWS-1252", "1031"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
103 # "dz" => ["Dzongkha", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
104 "el" => ["Greek", "WINDOWS-1253", "1032"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
105 "en" => ["English", "WINDOWS-1252", "1033"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
106 "eo" => ["Esperanto", "WINDOWS-1252", "9998"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
107 "es" => ["Spanish", "WINDOWS-1252", "1034"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
108 "et" => ["Estonian", "WINDOWS-1257", "1061"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
109 "eu" => ["Basque", "WINDOWS-1252", "1069"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
110 "fa" => ["Farsi", "WINDOWS-1256", "1065"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
111 "fi" => ["Finnish", "WINDOWS-1252", "1035"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
112 "fr" => ["French", "WINDOWS-1252", "1036"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
113 "ga" => ["Irish", "WINDOWS-1252", "2108"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
114 "gl" => ["Galician", "WINDOWS-1252", "1110"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
115 # "gu" => ["Gujarati", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
116 "he" => ["Hebrew", "WINDOWS-1255", "1037"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
117 # "hi" => ["Hindi", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
118 "hr" => ["Croatian", "WINDOWS-1250", "1050"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
119 "hu" => ["Hungarian", "WINDOWS-1250", "1038"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
120 "id" => ["Indonesian", "WINDOWS-1252", "1057"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
121 "is" => ["Icelandic", "WINDOWS-1252", "15"], #This should be 1039!
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
122 "it" => ["Italian", "WINDOWS-1252", "1040"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
123 "ja" => ["Japanese", "CP932", "1041"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
124 # "ka" => ["Georgian", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
125 "ko" => ["Korean", "CP949", "1042"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
126 "ku" => ["Kurdish", "WINDOWS-1254", "9999"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
127 "lb" => ["Luxembourgish", "WINDOWS-1252", "4103"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
128 "lt" => ["Lithuanian", "WINDOWS-1257", "1063"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
129 "lv" => ["Latvian", "WINDOWS-1257", "1062"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
130 "mk" => ["Macedonian", "WINDOWS-1251", "1071"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
131 # "ml" => ["Malayalam", "UTF-8"],
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
132 # "mr" => ["Marathi", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
133 "mn" => ["Mongolian", "WINDOWS-1251", "1104"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
134 "ms" => ["Malay", "WINDOWS-1252", "1086"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
135 "nb" => ["Norwegian", "WINDOWS-1252", "1044"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
136 # "ne" => ["Nepal", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
137 "nl" => ["Dutch", "WINDOWS-1252", "1043"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
138 "nn" => ["NorwegianNynorsk", "WINDOWS-1252", "2068"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
139 # "oc" => ["Occitan", "WINDOWS-1252"],
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
140 # "pa" => ["Punjabi", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
141 "pl" => ["Polish", "WINDOWS-1250", "1045"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
142 "pt" => ["Portuguese", "WINDOWS-1252", "2070"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
143 "pt_BR" => ["PortugueseBR", "WINDOWS-1252", "1046"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
144 "ro" => ["Romanian", "WINDOWS-1250", "1048"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
145 "ru" => ["Russian", "WINDOWS-1251", "1049"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
146 # "rw" => ["Kinyarwanda", "UTF-8"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
147 "sk" => ["Slovak", "WINDOWS-1250", "1051"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
148 "sl" => ["Slovenian", "WINDOWS-1250", "1060"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
149 # "so" => ["Somali", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
150 "sq" => ["Albanian", "WINDOWS-1252", "1052"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
151 "sr" => ["Serbian", "WINDOWS-1251", "3098"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
152 "sr\@latin" => ["SerbianLatin", "WINDOWS-1250", "2074"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
153 "sv" => ["Swedish", "WINDOWS-1252", "1053"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
154 # "ta" => ["Tamil", "UTF-8"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
155 "th" => ["Thai", "WINDOWS-874", "1054"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
156 "tr" => ["Turkish", "WINDOWS-1254", "1055"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
157 "uk" => ["Ukrainian", "WINDOWS-1251", "1058"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
158 "uz" => ["Uzbek", "WINDOWS-1252", "1091"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
159 # "ur" => ["Urdu", "UTF-8"],
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
160 # "vi" => ["Vietnamese", "WINDOWS-1258"],
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
161 # "wa" => ["Walloon", "WINDOWS-1252"],
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
162 "zh_CN" => ["SimpChinese", "WINDOWS-936", "2052"],
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
163 "zh_TW" => ["TradChinese", "CP950", "1028"],
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
164 );
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
165
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
166 my @localeKeys = keys(%localeNames);
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
167
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
168 # Create the holder for the results
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
169 # %result{"locale"}{"stringname"} = result line
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
170 print "Parsing nsis_translations.desktop\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
171 my %result;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
172
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
173 # Create a hash of the keys to translate
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
174 open (MYFILE, $translations);
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
175 while (<MYFILE>) {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
176 chomp $_;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
177 if ($_ =~ /Encoding=UTF-8/)
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
178 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
179 next;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
180 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
181 elsif ($_ =~ /^(\w+)=(.*)/)
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
182 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
183 my $line = "!define $1 \"$2\"\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
184 $result{"en"}{"$1"} = $line;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
185 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
186 elsif ($_ =~ /^(\w+)\[(\w+)\]=(.*)/)
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
187 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
188 my $line = "!define $1 \"$3\"\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
189 $result{"$2"}{"$1"} = $line;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
190 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
191 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
192 close (MYFILE);
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
193
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
194 # Lets insert the default languages
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
195 # in the installer file which means replacing:
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
196 # @INSERTMACRO_MUI_LANGUAGE@
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
197 # By the list of locales:
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
198 # !insertmacro MUI_LANGUAGE "French"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
199
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
200 my $muiLanguages;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
201 $muiLanguages = '
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
202 ;; English goes first because its the default. The rest are
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
203 ;; in alphabetical order (at least the strings actually displayed
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
204 ;; will be).
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
205 !insertmacro MUI_LANGUAGE "English"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
206 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
207
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
208 # The specific GCompris translation for the installer
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
209 # replacing:
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
210 # @GCOMPRIS_MACRO_INCLUDE_LANGFILE@
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
211 # By the list of locales:
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
212 # !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ALBANIAN" "${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\albanian.nsh"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
213
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
214 my $gcomprisLanguages;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
215
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
216 $gcomprisLanguages .= '
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
217 ;--------------------------------
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
218 ;Translations
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
219 !define GCOMPRIS_DEFAULT_LANGFILE "${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\en.nsh"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
220 ;;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
221 ;; Windows GCompris NSIS installer language macros
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
222 ;;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
223
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
224 !macro GCOMPRIS_MACRO_DEFAULT_STRING LABEL VALUE
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
225 !ifndef "${LABEL}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
226 !define "${LABEL}" "${VALUE}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
227 !ifdef INSERT_DEFAULT
30394
7681b4ac292c Further updates to the create_nsis_translations.pl script.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30392
diff changeset
228 !warning "${LANG} lang file missing ${LABEL}, using default..."
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
229 !endif
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
230 !endif
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
231 !macroend
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
232
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
233 !macro GCOMPRIS_MACRO_LANGSTRING_INSERT LABEL LANG
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
234 LangString "${LABEL}" "${LANG_${LANG}}" "${${LABEL}}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
235 !undef "${LABEL}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
236 !macroend
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
237
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
238 !macro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN LANG
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
239 !define CUR_LANG "${LANG}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
240 !macroend
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
241 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
242
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
243
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
244 # GCOMPRIS_MACRO_LANGUAGEFILE_END
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
245 $gcomprisLanguages .= '
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
246 !macro GCOMPRIS_MACRO_LANGUAGEFILE_END
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
247 !define INSERT_DEFAULT
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
248 !include "${GCOMPRIS_DEFAULT_LANGFILE}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
249 !undef INSERT_DEFAULT
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
250
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
251 ; String labels should match those from the default language file.
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
252 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
253
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
254 my $text_en = $result{"en"};
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
255 foreach my $keyEn (keys(%$text_en)) {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
256 $gcomprisLanguages .= " !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT $keyEn \${CUR_LANG}";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
257 $gcomprisLanguages .= "\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
258 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
259
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
260 $gcomprisLanguages .= '
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
261 !undef CUR_LANG
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
262 !macroend
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
263 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
264
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
265 $gcomprisLanguages .= '
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
266 !macro GCOMPRIS_MACRO_INCLUDE_LANGFILE LANG FILE
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
267 !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN "${LANG}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
268 !include "${FILE}"
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
269 !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_END
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
270 !macroend
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
271 ';
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
272
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
273 #
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
274 # Create each nsh translation file
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
275 #
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
276
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
277 print "Creating the nsh default file\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
278 open (DESC, ">$tmp_dir/en.nsh");
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
279 print DESC ";; Auto generated file by create_nsis_translations.pl\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
280 foreach my $keyEn (keys(%$text_en)) {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
281 my $line = $result{'en'}{$keyEn};
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
282 $line =~ s/!define /!insertmacro GCOMPRIS_MACRO_DEFAULT_STRING /;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
283 print DESC $line;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
284 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
285 close DESC;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
286
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
287 $gcomprisLanguages .= " !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE".
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
288 " \"ENGLISH\"".
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
289 " \"\${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\en.nsh\"\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
290
30396
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
291 my $selectTranslationFunction = '
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
292 !macro SELECT_TRANSLATION_SECTION LANG_NAME LANG_CODE
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
293 StrCmp "$LANGUAGE" "${LANG_${LANG_NAME}}" 0 end_${LANG_CODE}
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
294 !insertmacro SelectSection ${SecLang_${LANG_CODE}}
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
295 Goto done
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
296 end_${LANG_CODE}:
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
297 !macroend
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
298 ; Convert the current $LANGUAGE to a language code that we can use for translation mo selection
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
299 ; If there\'s a better way to do this, I\'d love to know it
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
300 !macro SELECT_TRANSLATION_FUNCTION
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
301 ';
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
302
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
303 #
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
304 # Two pass are needed:
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
305 # - create the utf8 file
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
306 # - transform it to the proper windows locale
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
307 #
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
308 print "Creating the nsh locale files\n";
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
309 foreach my $lang (@localeKeys) {
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
310 if ( $lang eq "en" ) { next; }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
311 open (DESC, ">$tmp_dir/$lang.nsh.utf8");
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
312 print DESC ";; Auto generated file by create_nsis_translations.pl\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
313 print DESC ";; Code Page: $localeNames{$lang}[1]\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
314
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
315 my $text_locale = $result{"$lang"};
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
316 my $total_key_count = 0;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
317 my $found_key_count = 0;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
318 foreach my $keyEn (keys(%$text_en)) {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
319 my $found = 0;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
320 $total_key_count++;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
321 foreach my $keyLocale (keys(%$text_locale)) {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
322 # Fine, we found a translation
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
323 if ( $keyLocale eq $keyEn )
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
324 {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
325 print DESC "$result{$lang}{$keyLocale}";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
326 $found = 1;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
327 $found_key_count++;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
328 last;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
329 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
330 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
331 # English keys are the reference.
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
332 # If not found they are inserted
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
333 #if ( ! $found )
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
334 #{
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
335 # print DESC "$result{'en'}{$keyEn}";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
336 #}
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
337 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
338 close DESC;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
339
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
340 # If we have at least 50% of the keys found, include the language
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
341 if (($found_key_count * 1.0 / $total_key_count) >= 0.5) {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
342 $muiLanguages .= " !insertmacro MUI_LANGUAGE \"$localeNames{$lang}[0]\"\n";
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
343 $gcomprisLanguages .= " !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE".
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
344 " \"". uc($localeNames{$lang}[0]) . "\"".
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
345 " \"\${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\$lang.nsh\"\n";
30396
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
346 $selectTranslationFunction .= " !insertmacro SELECT_TRANSLATION_SECTION".
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
347 " \"" . uc($localeNames{$lang}[0]) . "\" \"$lang\"\n";
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
348 } else {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
349 print "Ignoring language $lang because it is less than 50% translated ($found_key_count of $total_key_count).\n";
30396
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
350 next;
30395
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
351 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
352
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
353
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
354 # iconv conversion
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
355 system("iconv -f UTF-8 -t $localeNames{$lang}[1] $tmp_dir/$lang.nsh.utf8 > $tmp_dir/$lang.nsh");
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
356 if ($? ne 0)
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
357 {
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
358 die("ERROR: Failed to run: iconv -f UTF-8 -t $localeNames{$lang}[1] $lang.nsh.utf8 > $lang.nsh\n");
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
359 }
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
360 #`rm $tmp_dir/$lang.nsh.utf8`;
5edd3992f59d More improvements to create_nsis_translations.pl - I have more to do, but I'm
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30394
diff changeset
361
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
362 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
363
30396
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
364 $selectTranslationFunction .= '
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
365 done:
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
366 !macroend
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
367 ';
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
368
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
369 # We have all the data, let's replace it
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
370 my $gcomprisInstaller;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
371 open (MYFILE, $installer);
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
372 while (<MYFILE>) {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
373 if ($_ =~ /\@INSERT_TRANSLATIONS\@/)
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
374 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
375 print "Processing \@INSERT_TRANSLATIONS\@\n";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
376 $gcomprisInstaller .= $muiLanguages;
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
377 $gcomprisInstaller .= $gcomprisLanguages;
30396
62f0988c666c Final piece of getting the installer translations integrated with the regular
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30395
diff changeset
378 $gcomprisInstaller .= $selectTranslationFunction;
30388
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
379 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
380 else
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
381 {
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
382 $gcomprisInstaller .= "$_";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
383 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
384 }
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
385 close (MYFILE);
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
386
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
387 # Rewrite the file with the replaced data
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
388 open (MYFILE, ">$installer");
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
389 print MYFILE "$gcomprisInstaller";
69c70c40baea Add unmodified create_nsis_translations.pl script from the gcompris project.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
390 close (MYFILE);