From a8bf33d851c88107a4673ef6fc97b303efb537d8 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Tue, 27 Jan 2009 04:01:50 +0100 Subject: Enabled gettext translations on windows. --- packaging/windows/make-translations.vbs | 42 +++++++++++++++++++++++++++++++++ packaging/windows/setup.nsi | 3 +++ 2 files changed, 45 insertions(+) create mode 100644 packaging/windows/make-translations.vbs (limited to 'packaging') diff --git a/packaging/windows/make-translations.vbs b/packaging/windows/make-translations.vbs new file mode 100644 index 00000000..48246188 --- /dev/null +++ b/packaging/windows/make-translations.vbs @@ -0,0 +1,42 @@ +Set fso = CreateObject("Scripting.FileSystemObject") +Set WshShell = CreateObject("WScript.Shell") +Dim s, infile, outfile, command + +Function CreateFolderIfNonexistent(folder) + if not fso.FolderExists(folder) then + fso.CreateFolder(folder) + end if +end Function + +'check for existence of msgfmt +if not fso.FileExists("msgfmt.exe") then + WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again." + WScript.Quit(1) +end if + +CreateFolderIfNonexistent("..\..\translations\") + +'open translation list +Set stream = fso.GetFile("..\..\po\LINGUAS").OpenAsTextStream(1, 0) + +'iterate contents of translations file +translations = 0 +do while not stream.AtEndOfStream + s = stream.ReadLine() + if inStr(s, "#") = false then + 'create the output directory + CreateFolderIfNonexistent("..\..\translations\" + s) + CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES") + 'build the translate command + infile = "../../po/" + s + ".po" + outfile = "../../translations/" + s +"/LC_MESSAGES/tmw.mo" + command = "msgfmt -c -o " + outfile + " " + infile + 'execute translate command + errval = WshShell.run(command, 0, true) + if errval = 0 then + translations = translations + 1 + end if + end if +loop + +WScript.echo translations, " translations compiled." \ No newline at end of file diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi index ec57051c..55b3bd45 100644 --- a/packaging/windows/setup.nsi +++ b/packaging/windows/setup.nsi @@ -156,6 +156,7 @@ Section "Core files (required)" SecCore CreateDirectory "$INSTDIR\data\graphics\gui" CreateDirectory "$INSTDIR\data\graphics\images" CreateDirectory "$INSTDIR\docs" + CreateDirectory "$INSTDIR\translations" SetOverwrite ifnewer SetOutPath "$INSTDIR" @@ -180,6 +181,8 @@ Section "Core files (required)" SecCore File /nonfatal "${SRCDIR}\data\music\*.ogg" SetOutPath "$INSTDIR\docs" File "${SRCDIR}\docs\FAQ.txt" + SetOutPath "$INSTDIR\" + File /nonfatal /r "${SRCDIR}\translations" SectionEnd Section -AdditionalIcons -- cgit v1.2.3-70-g09d2 From ce36f9733315ffecb41379f9f07063133968a54f Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 28 Jan 2009 20:40:34 +0100 Subject: Made translations and music optional components when installing on windows. --- packaging/windows/setup.nsi | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'packaging') diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi index 55b3bd45..6859a941 100644 --- a/packaging/windows/setup.nsi +++ b/packaging/windows/setup.nsi @@ -43,6 +43,8 @@ SetCompressor /SOLID lzma !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING" ; Directory page !insertmacro MUI_PAGE_DIRECTORY +; Components page +!insertmacro MUI_PAGE_COMPONENTS ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ; Finish page @@ -152,11 +154,9 @@ Section "Core files (required)" SecCore CreateDirectory "$INSTDIR\data\graphics" CreateDirectory "$INSTDIR\data\help" CreateDirectory "$INSTDIR\data\icons" - CreateDirectory "$INSTDIR\data\music" CreateDirectory "$INSTDIR\data\graphics\gui" CreateDirectory "$INSTDIR\data\graphics\images" CreateDirectory "$INSTDIR\docs" - CreateDirectory "$INSTDIR\translations" SetOverwrite ifnewer SetOutPath "$INSTDIR" @@ -177,14 +177,31 @@ Section "Core files (required)" SecCore File "${SRCDIR}\data\help\*.txt" SetOutPath "$INSTDIR\data\icons\" File "${SRCDIR}\data\icons\tmw.ico" - SetOutPath "$INSTDIR\data\music" - File /nonfatal "${SRCDIR}\data\music\*.ogg" SetOutPath "$INSTDIR\docs" File "${SRCDIR}\docs\FAQ.txt" - SetOutPath "$INSTDIR\" +SectionEnd + +Section "Music" SecMusic + CreateDirectory "$INSTDIR\data\music" + SetOutPath "$INSTDIR\data\music" + File /nonfatal "${SRCDIR}\data\music\*.ogg" +SectionEnd + +Section "Translations" SecTrans + CreateDirectory "$INSTDIR\translations" + SetOutPath "$INSTDIR\translations" File /nonfatal /r "${SRCDIR}\translations" SectionEnd +;Package descriptions +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "The TMW program files." + !insertmacro MUI_DESCRIPTION_TEXT ${SecMusic} "Background music." + !insertmacro MUI_DESCRIPTION_TEXT ${SecTrans} "Translations for the user interface into 23 different languages. Uncheck this component to leave it in English." +!insertmacro MUI_FUNCTION_DESCRIPTION_END + + + Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\The Mana World\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" -- cgit v1.2.3-70-g09d2 From d5fb7965fcca5b85f4ff65e6bcf25b9c94b8e103 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 29 Jan 2009 20:01:04 +0100 Subject: Converted CRLF newlines to LF --- packaging/windows/make-translations.vbs | 82 ++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'packaging') diff --git a/packaging/windows/make-translations.vbs b/packaging/windows/make-translations.vbs index 48246188..fbecd822 100644 --- a/packaging/windows/make-translations.vbs +++ b/packaging/windows/make-translations.vbs @@ -1,42 +1,42 @@ -Set fso = CreateObject("Scripting.FileSystemObject") -Set WshShell = CreateObject("WScript.Shell") -Dim s, infile, outfile, command - -Function CreateFolderIfNonexistent(folder) - if not fso.FolderExists(folder) then - fso.CreateFolder(folder) - end if -end Function - -'check for existence of msgfmt -if not fso.FileExists("msgfmt.exe") then - WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again." - WScript.Quit(1) -end if - -CreateFolderIfNonexistent("..\..\translations\") - -'open translation list -Set stream = fso.GetFile("..\..\po\LINGUAS").OpenAsTextStream(1, 0) - -'iterate contents of translations file -translations = 0 -do while not stream.AtEndOfStream - s = stream.ReadLine() - if inStr(s, "#") = false then - 'create the output directory - CreateFolderIfNonexistent("..\..\translations\" + s) - CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES") - 'build the translate command - infile = "../../po/" + s + ".po" - outfile = "../../translations/" + s +"/LC_MESSAGES/tmw.mo" - command = "msgfmt -c -o " + outfile + " " + infile - 'execute translate command - errval = WshShell.run(command, 0, true) - if errval = 0 then - translations = translations + 1 - end if - end if -loop - +Set fso = CreateObject("Scripting.FileSystemObject") +Set WshShell = CreateObject("WScript.Shell") +Dim s, infile, outfile, command + +Function CreateFolderIfNonexistent(folder) + if not fso.FolderExists(folder) then + fso.CreateFolder(folder) + end if +end Function + +'check for existence of msgfmt +if not fso.FileExists("msgfmt.exe") then + WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again." + WScript.Quit(1) +end if + +CreateFolderIfNonexistent("..\..\translations\") + +'open translation list +Set stream = fso.GetFile("..\..\po\LINGUAS").OpenAsTextStream(1, 0) + +'iterate contents of translations file +translations = 0 +do while not stream.AtEndOfStream + s = stream.ReadLine() + if inStr(s, "#") = false then + 'create the output directory + CreateFolderIfNonexistent("..\..\translations\" + s) + CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES") + 'build the translate command + infile = "../../po/" + s + ".po" + outfile = "../../translations/" + s +"/LC_MESSAGES/tmw.mo" + command = "msgfmt -c -o " + outfile + " " + infile + 'execute translate command + errval = WshShell.run(command, 0, true) + if errval = 0 then + translations = translations + 1 + end if + end if +loop + WScript.echo translations, " translations compiled." \ No newline at end of file -- cgit v1.2.3-70-g09d2 From e6d4a7e4dba7efda4ce06b8410ee31086b54c920 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 4 Feb 2009 17:04:22 +0100 Subject: Fixed a bug in windows setup script which caused translations to be extracted to the wrong directory. --- packaging/windows/setup.nsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packaging') diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi index 6859a941..c5d1b483 100644 --- a/packaging/windows/setup.nsi +++ b/packaging/windows/setup.nsi @@ -188,8 +188,7 @@ Section "Music" SecMusic SectionEnd Section "Translations" SecTrans - CreateDirectory "$INSTDIR\translations" - SetOutPath "$INSTDIR\translations" + SetOutPath "$INSTDIR" File /nonfatal /r "${SRCDIR}\translations" SectionEnd -- cgit v1.2.3-70-g09d2