[gcompris] created a new tool named tools/create_nsis_translations.pl



commit d4b5409384ad66e99f0521ada71ae98b0617b4fa
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sun Jul 19 15:10:38 2009 +0200

    created a new tool named tools/create_nsis_translations.pl
    It is not yet completely integrated. Its goal is to create the
    nsis installer translation automatically from the po files.

 Makefile.am                       |    6 +-
 gcompris-installer.nsi.in         |   83 +++++---------------------
 nsis/langmacros.nsh               |   33 ++++-------
 nsis_translations.desktop.in      |   13 ++++
 po/POTFILES.in                    |    1 +
 tools/create_nsis_translations.pl |  120 +++++++++++++++++++++++++++++++++++++
 6 files changed, 165 insertions(+), 91 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0751e27..eee02dc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,8 +26,10 @@ Applications_in_files =
 Applications_DATA =
 else
 Applicationsdir = $(datadir)/applications/
-Applications_in_files = gcompris.desktop.in gcompris-edit.desktop.in
-Applications_DATA = gcompris.desktop gcompris-edit.desktop
+Applications_in_files = gcompris.desktop.in gcompris-edit.desktop.in \
+	nsis_translations.desktop.in
+Applications_DATA = gcompris.desktop gcompris-edit.desktop \
+	nsis_translations.desktop
 endif
 
 @INTLTOOL_DESKTOP_RULE@
diff --git a/gcompris-installer.nsi.in b/gcompris-installer.nsi.in
index e15b2d1..f0d5d3f 100644
--- a/gcompris-installer.nsi.in
+++ b/gcompris-installer.nsi.in
@@ -57,8 +57,8 @@ SetDateSave on
   !define MUI_HEADERIMAGE_BITMAP		".\nsis\gcompris-header.bmp"
 
   ; Alter License section
-  !define MUI_LICENSEPAGE_BUTTON		$(GCOMPRIS_LICENSE_BUTTON)
-  !define MUI_LICENSEPAGE_TEXT_BOTTOM		$(GCOMPRIS_LICENSE_BOTTOM_TEXT)
+  !define MUI_LICENSEPAGE_BUTTON		$(GcomprisLicenseButton)
+  !define MUI_LICENSEPAGE_TEXT_BOTTOM		$(GcomprisLicenseBottomText)
 
   !define MUI_COMPONENTSPAGE_SMALLDESC
   !define MUI_ABORTWARNING
@@ -66,7 +66,7 @@ SetDateSave on
   ;Finish Page config
   !define MUI_FINISHPAGE_RUN			"$INSTDIR\gcompris.exe"
   !define MUI_FINISHPAGE_RUN_NOTCHECKED
-  !define MUI_FINISHPAGE_LINK			$(GCOMPRIS_FINISH_VISIT_WEB_SITE)
+  !define MUI_FINISHPAGE_LINK			$(GcomprisFinishVisitWebSite)
   !define MUI_FINISHPAGE_LINK_LOCATION          "http://gcompris.net/";
 
 ;--------------------------------
@@ -96,33 +96,7 @@ SetDateSave on
 
   !insertmacro MUI_LANGUAGE "English"
 
-  !insertmacro MUI_LANGUAGE "Albanian"
-  !insertmacro MUI_LANGUAGE "Bulgarian"
-  !insertmacro MUI_LANGUAGE "Catalan"
-  !insertmacro MUI_LANGUAGE "Czech"
-  !insertmacro MUI_LANGUAGE "Danish"
-  !insertmacro MUI_LANGUAGE "SimpChinese"
-  !insertmacro MUI_LANGUAGE "TradChinese"
-  !insertmacro MUI_LANGUAGE "German"
-  !insertmacro MUI_LANGUAGE "Spanish"
-  !insertmacro MUI_LANGUAGE "French"
-  !insertmacro MUI_LANGUAGE "Hebrew"
-  !insertmacro MUI_LANGUAGE "Italian"
-  !insertmacro MUI_LANGUAGE "Japanese"
-  !insertmacro MUI_LANGUAGE "Korean"
-  !insertmacro MUI_LANGUAGE "Hungarian"
-  !insertmacro MUI_LANGUAGE "Dutch"
-  !insertmacro MUI_LANGUAGE "Norwegian"
-  !insertmacro MUI_LANGUAGE "Polish"
-  !insertmacro MUI_LANGUAGE "PortugueseBR"
-  !insertmacro MUI_LANGUAGE "Portuguese"
-  !insertmacro MUI_LANGUAGE "Romanian"
-  !insertmacro MUI_LANGUAGE "Russian"
-  !insertmacro MUI_LANGUAGE "Serbian"
-  !insertmacro MUI_LANGUAGE "Slovak"
-  !insertmacro MUI_LANGUAGE "Slovenian"
-  !insertmacro MUI_LANGUAGE "Finnish"
-  !insertmacro MUI_LANGUAGE "Swedish"
+  @INSERTMACRO_MUI_LANGUAGE@
 
 ;--------------------------------
 ;Translations
@@ -131,34 +105,7 @@ SetDateSave on
 
   !include "${GCOMPRIS_NSIS_INCLUDE_PATH}\langmacros.nsh"
 
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ALBANIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\albanian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "BULGARIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\bulgarian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "CATALAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\catalan.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "CZECH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\czech.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "DANISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\danish.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "DUTCH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\dutch.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ENGLISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\english.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "FINNISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\finnish.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "FRENCH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\french.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "GERMAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\german.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "HEBREW"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\hebrew.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "HUNGARIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\hungarian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ITALIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\italian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "JAPANESE"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\japanese.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "KOREAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\korean.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "NORWEGIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\norwegian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "POLISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\polish.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "PORTUGUESE"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\portuguese.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "PORTUGUESEBR"	"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\portuguese-br.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "ROMANIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\romanian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "RUSSIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\russian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SERBIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\serbian-latin.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SIMPCHINESE"	"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\simp-chinese.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SLOVAK"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\slovak.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SLOVENIAN"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\slovenian.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SPANISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\spanish.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "SWEDISH"		"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\swedish.nsh"
-  !insertmacro GCOMPRIS_MACRO_INCLUDE_LANGFILE "TRADCHINESE"	"${GCOMPRIS_NSIS_INCLUDE_PATH}\translations\trad-chinese.nsh"
+  @GCOMPRIS_MACRO_INCLUDE_LANGFILE@
 
 ;--------------------------------
 ;Reserve Files
@@ -221,7 +168,7 @@ Section -SecUninstallOldGcompris
 	  ; We get here because versions 0.60a1 and 0.60a2 don't have versions set in the registry
 	  ; and versions 0.60 and lower did not correctly set the uninstall reg string
 	  ; (the string was set in quotes)
-          MessageBox MB_YESNO $(GCOMPRIS_PROMPT_WIPEOUT) IDYES do_wipeout IDNO cancel_install
+          MessageBox MB_YESNO $(GcomprisPromptWipeout) IDYES do_wipeout IDNO cancel_install
           cancel_install:
             Quit
 
@@ -268,7 +215,7 @@ SectionEnd
 ;--------------------------------
 ;Gcompris Install Section
 
-Section $(GCOMPRIS_SECTION_TITLE) SecGcompris
+Section "GCompris" SecGcompris
   SectionIn 1 RO
 
   ; Check install rights..
@@ -285,7 +232,7 @@ Section $(GCOMPRIS_SECTION_TITLE) SecGcompris
     WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R1\bin"
     WriteRegStr HKLM ${GCOMPRIS_REG_KEY} "" "$INSTDIR"
     WriteRegStr HKLM ${GCOMPRIS_REG_KEY} "Version" "${GCOMPRIS_VERSION}"
-    WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GCOMPRIS_UNINSTALL_DESC)
+    WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GcomprisUninstallDesc)
     WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GCOMPRIS_UNINST_EXE}"
     ; Sets scope of the desktop and Start Menu entries for all users.
     SetShellVarContext "all"
@@ -294,7 +241,7 @@ Section $(GCOMPRIS_SECTION_TITLE) SecGcompris
   gcompris_hkcu:
     WriteRegStr HKCU ${GCOMPRIS_REG_KEY} "" "$INSTDIR"
     WriteRegStr HKCU ${GCOMPRIS_REG_KEY} "Version" "${GCOMPRIS_VERSION}"
-    WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GCOMPRIS_UNINSTALL_DESC)
+    WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GcomprisUninstallDesc)
     WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GCOMPRIS_UNINST_EXE}"
     Goto gcompris_install_files
 
@@ -458,13 +405,13 @@ Section Uninstall
 
   cant_uninstall:
     IfSilent skip_mb
-    MessageBox MB_OK $(un.GCOMPRIS_UNINSTALL_ERROR_1) IDOK
+    MessageBox MB_OK $(unGcomprisUninstallError1) IDOK
     skip_mb:
     Quit
 
   no_rights:
     IfSilent skip_mb1
-    MessageBox MB_OK $(un.GCOMPRIS_UNINSTALL_ERROR_2) IDOK
+    MessageBox MB_OK $(unGcomprisUninstallError2) IDOK
     skip_mb1:
     Quit
 
@@ -475,7 +422,7 @@ SectionEnd ; end of uninstall section
 ;Descriptions
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
   !insertmacro MUI_DESCRIPTION_TEXT ${SecGcompris} \
-	$(GCOMPRIS_SECTION_DESCRIPTION)
+	$(GcomprisSectionDescription)
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
 ;--------------------------------
@@ -642,7 +589,7 @@ FunctionEnd
 Function RunCheck
   System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gcompris_is_running") i .R0'
   IntCmp $R0 0 done
-  MessageBox MB_OK|MB_ICONEXCLAMATION $(GCOMPRIS_IS_RUNNING) IDOK
+  MessageBox MB_OK|MB_ICONEXCLAMATION $(GcomprisIsRunning) IDOK
     Abort
   done:
 FunctionEnd
@@ -650,7 +597,7 @@ FunctionEnd
 Function un.RunCheck
   System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gcompris_is_running") i .R0'
   IntCmp $R0 0 done
-  MessageBox MB_OK|MB_ICONEXCLAMATION $(GCOMPRIS_IS_RUNNING) IDOK
+  MessageBox MB_OK|MB_ICONEXCLAMATION $(GcomprisIsRunning) IDOK
     Abort
   done:
 FunctionEnd
@@ -659,7 +606,7 @@ Function .onInit
   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "gcompris_installer_running") i .r1 ?e'
   Pop $R0
   StrCmp $R0 0 +3
-    MessageBox MB_OK|MB_ICONEXCLAMATION $(INSTALLER_IS_RUNNING)
+    MessageBox MB_OK|MB_ICONEXCLAMATION $(InstallerIsRunning)
     Abort
   Call RunCheck
   StrCpy $name "Gcompris ${GCOMPRIS_VERSION}"
diff --git a/nsis/langmacros.nsh b/nsis/langmacros.nsh
index 44edb51..4b692d6 100755
--- a/nsis/langmacros.nsh
+++ b/nsis/langmacros.nsh
@@ -2,15 +2,6 @@
 ;; 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}"
@@ -29,28 +20,28 @@
   ; String labels should match those from the default language file.
 
   ; Startup checks
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT INSTALLER_IS_RUNNING			${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_IS_RUNNING				${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT InstallerIsRunning		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisIsRunning		${CUR_LANG}
 
   ; License Page
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_LICENSE_BUTTON			${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_LICENSE_BOTTOM_TEXT		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisLicenseButton		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisLicenseBottomText	${CUR_LANG}
 
   ; Components Page
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_SECTION_TITLE			${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_SECTION_DESCRIPTION		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisSectionTitle		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisSectionDescription	${CUR_LANG}
 
   ; Installer Finish Page
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_FINISH_VISIT_WEB_SITE		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisFinishVisitWebSite	${CUR_LANG}
 
   ; Gcompris Section Prompts and Texts
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_UNINSTALL_DESC			${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_PROMPT_WIPEOUT			${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GCOMPRIS_PROMPT_DIR_EXISTS		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisUninstallDesc	${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisPromptWipeout	${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT GcomprisPromptDirExists	${CUR_LANG}
 
   ; Uninstall Section Prompts
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT un.GCOMPRIS_UNINSTALL_ERROR_1		${CUR_LANG}
-  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT un.GCOMPRIS_UNINSTALL_ERROR_2		${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT unGcomprisUninstallError1	${CUR_LANG}
+  !insertmacro GCOMPRIS_MACRO_LANGSTRING_INSERT unGcomprisUninstallError2	${CUR_LANG}
 
   !undef CUR_LANG
 !macroend
diff --git a/nsis_translations.desktop.in b/nsis_translations.desktop.in
new file mode 100644
index 0000000..78ac252
--- /dev/null
+++ b/nsis_translations.desktop.in
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Encoding=UTF-8
+_InstallerIsRunning=The installer is already running.
+_GcomprisisRunning=An instance of GCompris is currently running. Exit GCompris and then try again.
+_GcomprisLicenseButton=Next >
+_GcomprisLicenseBottomText=GCompris is released under the GNU General Public License (GPL). The license is provided here for information purposes only. \$_CLICK
+_GcomprisSectionDescription=Core GCompris files and dlls
+_GcomprisFinishVisitWebSite=Visit the Windows GCompris Web Page
+_GcomprisUninstallDesc=GCompris (remove only)
+_GcomprisPromptWipeout=Your old GCompris directory is about to be deleted. Would you like to continue?$\\r$\\rNote: Any non-standard plugins that you may have installed will be deleted.$\\rGCompris user settings will not be affected.
+_GcomprisPromptDirExists=The installation directory you specified already exists. Any contents$\\rwill be deleted. Would you like to continue?
+_unGCOMPRISUninstallError1=the uninstaller could not find registry entries for GCompris.$\\rIt is likely that another user installed this application.
+_unGCOMPRISUninstallError2=You do not have permission to uninstall this application.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9c299e8..7a693df 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -221,6 +221,7 @@ boards/wordprocessor.xml.in
 boards/wordsgame.xml.in
 gcompris-edit.desktop.in
 gcompris.desktop.in
+nsis_translations.desktop.in
 src/boards/advanced_colors.c
 src/boards/algebra.c
 src/boards/algebra_guesscount.c
diff --git a/tools/create_nsis_translations.pl b/tools/create_nsis_translations.pl
new file mode 100755
index 0000000..cac80b6
--- /dev/null
+++ b/tools/create_nsis_translations.pl
@@ -0,0 +1,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;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]