Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Coudoin <bruno.coudoin@free.fr>2009-07-22 22:17:29 (GMT)
committer Bruno Coudoin <bruno.coudoin@free.fr>2009-07-22 22:17:29 (GMT)
commit306d8575f40ee4f4a6a8291ff2924d3bcb61be10 (patch)
tree316d1936906d151ba5032d54fe6aa4d96581839c
parentafe3311aa9bf23b8a4232ce83281f07568478808 (diff)
integrated the langmacros.nsh in the create_nsis_translations.pl.
-rwxr-xr-xnsis/langmacros.nsh57
-rwxr-xr-xtools/create_nsis_translations.pl110
2 files changed, 79 insertions, 88 deletions
diff --git a/nsis/langmacros.nsh b/nsis/langmacros.nsh
deleted file mode 100755
index 4a6b46e..0000000
--- a/nsis/langmacros.nsh
+++ /dev/null
@@ -1,57 +0,0 @@
-;;
-;; Windows Gcompris NSIS installer language macros
-;;
-
-!macro GCOMPRIS_MACRO_DEFAULT_STRING LABEL VALUE
- !ifndef "${LABEL}"
- !define "${LABEL}" "${VALUE}"
- !ifdef INSERT_DEFAULT
- !warning "${LANG} lang file mising ${LABEL}, using default.."
- !endif
- !endif
-!macroend
-
-!macro GCOMPRIS_MACRO_LANGSTRING_INSERT LABEL LANG
- LangString "${LABEL}" "${LANG_${LANG}}" "${${LABEL}}"
- !undef "${LABEL}"
-!macroend
-
-!macro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN LANG
- !define CUR_LANG "${LANG}"
-!macroend
-
-!macro GCOMPRIS_MACRO_LANGUAGEFILE_END
- !define INSERT_DEFAULT
- !include "${GCOMPRIS_DEFAULT_LANGFILE}"
- !undef INSERT_DEFAULT
-
- ; GCOMPRIS Language file Version 3
- ; String labels should match those from the default language file.
-
- ; Startup checks
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT InstallerIsRunning ${CUR_LANG}
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisIsRunning ${CUR_LANG}
-
- ; License Page
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisLicenseButton ${CUR_LANG}
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisLicenseBottomText ${CUR_LANG}
-
- ; Installer Finish Page
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisFinishVisitWebSite ${CUR_LANG}
-
- ; Gcompris Section Prompts and Texts
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisPromptWipeout ${CUR_LANG}
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisPromptDirExists ${CUR_LANG}
-
- ; Uninstall Section Prompts
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT unGcomprisUninstallError1 ${CUR_LANG}
- !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT unGcomprisUninstallError2 ${CUR_LANG}
-
- !undef CUR_LANG
-!macroend
-
-!macro GCOMPRIS_MACRO_INCLUDE_LANGFILE LANG FILE
- !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN "${LANG}"
- !include "${FILE}"
- !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_END
-!macroend
diff --git a/tools/create_nsis_translations.pl b/tools/create_nsis_translations.pl
index 29a3da6..24c6a15 100755
--- a/tools/create_nsis_translations.pl
+++ b/tools/create_nsis_translations.pl
@@ -76,6 +76,32 @@ my %localeNames = (
my @localeKeys = keys(%localeNames);
+# Create the holder for the results
+# %result{"locale"}{"stringname"} = result line
+print "Parsing nsis_translations.desktop\n";
+my %result;
+
+# Create a hash of the keys to translate
+open (MYFILE, 'nsis_translations.desktop');
+while (<MYFILE>) {
+ chomp $_;
+ if ($_ =~ /Encoding=UTF-8/)
+ {
+ next;
+ }
+ elsif ($_ =~ /^(\w+)=(.*)/)
+ {
+ my $line = "!define $1 \"$2\"\n";
+ $result{"en"}{"$1"} = $line;
+ }
+ elsif ($_ =~ /^(\w+)\[(\w+)\]=(.*)/)
+ {
+ my $line = "!define $1 \"$3\"\n";
+ $result{"$2"}{"$1"} = $line;
+ }
+}
+close (MYFILE);
+
# Lets insert the default languages
# in the installer file which means replacing:
# @INSERTMACRO_MUI_LANGUAGE@
@@ -103,12 +129,61 @@ foreach my $lang (@localeKeys) {
my $gcomprisLanguages;
-$gcomprisLanguages .= "
+$gcomprisLanguages .= '
;--------------------------------
;Translations
- !define GCOMPRIS_DEFAULT_LANGFILE \"\${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\en.nsh\"
- !include \"\${GCOMPRIS_NSIS_INCLUDE_PATH}\\langmacros.nsh\"
-";
+ !define GCOMPRIS_DEFAULT_LANGFILE "${GCOMPRIS_NSIS_INCLUDE_PATH}\\translations\\en.nsh"
+;;
+;; Windows Gcompris NSIS installer language macros
+;;
+
+!macro GCOMPRIS_MACRO_DEFAULT_STRING LABEL VALUE
+ !ifndef "${LABEL}"
+ !define "${LABEL}" "${VALUE}"
+ !ifdef INSERT_DEFAULT
+ !warning "${LANG} lang file mising ${LABEL}, using default.."
+ !endif
+ !endif
+!macroend
+
+!macro GCOMPRIS_MACRO_LANGSTRING_INSERT LABEL LANG
+ LangString "${LABEL}" "${LANG_${LANG}}" "${${LABEL}}"
+ !undef "${LABEL}"
+!macroend
+
+!macro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN LANG
+ !define CUR_LANG "${LANG}"
+!macroend
+';
+
+
+# GCOMPRIS_MACRO_LANGUAGEFILE_END
+$gcomprisLanguages .= '
+!macro GCOMPRIS_MACRO_LANGUAGEFILE_END
+ !define INSERT_DEFAULT
+ !include "${GCOMPRIS_DEFAULT_LANGFILE}"
+ !undef INSERT_DEFAULT
+
+ ; String labels should match those from the default language file.
+';
+
+my $text_en = $result{"en"};
+foreach my $keyEn (keys(%$text_en)) {
+ $gcomprisLanguages .= " !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT $keyEn \${CUR_LANG}";
+}
+
+$gcomprisLanguages .= '
+ !undef CUR_LANG
+!macroend
+';
+
+$gcomprisLanguages .= '
+!macro GCOMPRIS_MACRO_INCLUDE_LANGFILE LANG FILE
+ !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_BEGIN "${LANG}"
+ !include "${FILE}"
+ !insertmacro GCOMPRIS_MACRO_LANGUAGEFILE_END
+!macroend
+';
foreach my $lang (@localeKeys) {
$gcomprisLanguages .= " !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE".
@@ -145,35 +220,8 @@ close (MYFILE);
#
# Create each nsh translation file
#
-print "Parsing nsis_translations.desktop\n";
-
-# Create the holder for the results
-# %result{"locale"}{"stringname"} = result line
-my %result;
-
-# Create a hash of the keys to translate
-open (MYFILE, 'nsis_translations.desktop');
-while (<MYFILE>) {
- chomp $_;
- if ($_ =~ /Encoding=UTF-8/)
- {
- next;
- }
- elsif ($_ =~ /^(\w+)=(.*)/)
- {
- my $line = "!define $1 \"$2\"\n";
- $result{"en"}{"$1"} = $line;
- }
- elsif ($_ =~ /^(\w+)\[(\w+)\]=(.*)/)
- {
- my $line = "!define $1 \"$3\"\n";
- $result{"$2"}{"$1"} = $line;
- }
-}
-close (MYFILE);
print "Creating the nsh default file\n";
-my $text_en = $result{"en"};
open (DESC, ">nsis/translations/en.nsh");
print DESC ";; Auto generated file by create_nsis_translations.pl\n";
foreach my $keyEn (keys(%$text_en)) {