From 5da13af4d0660c01e7aedb02083867a4484bedba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 19 Jun 2013 13:53:01 +0000 Subject: More advanced version of Langpack Refresher. For your langpack usage look at langpacks/czech/Refresh.bat script. git-svn-id: http://svn.miranda-ng.org/main/trunk@5038 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/lpgen/refresher.bat | 74 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 16 deletions(-) (limited to 'tools') diff --git a/tools/lpgen/refresher.bat b/tools/lpgen/refresher.bat index 517e5ad503..93f54720b6 100644 --- a/tools/lpgen/refresher.bat +++ b/tools/lpgen/refresher.bat @@ -1,29 +1,71 @@ @echo off - -REM You can run this script either from "tools\lpgen\" folder or from "langpacks\\" +cls echo ======================== -echo Langpack refresher -echo Author: Robyer +echo Langpack refresher +echo Author: Robyer echo ======================== +echo. -echo Set your variables in script and remove this line. & PAUSE & goto end +set err=0 +if "%~1" == "" ( + echo ERROR: You must specify language parameter! + set err=1 +) else ( + set "language=%~1" + + if not exist "..\..\langpacks\%language%" ( + echo ERROR: This language doesn't exists! + set err=1 + goto usage + ) +) -REM === VARIABLES TO SET === +if not "%~3" == "" ( + echo ERROR: You must specify 1 or 2 parameters only. + echo NOTE: If you have path with spaces inside, suround it with "". + set err=1 + goto usage +) -set "language=czech" & REM name of language from "langpacks\" folder -set "useOldLangpack=yes" & REM "yes" or "no", if "yes" make sure you correctly set path to old langpack file below -set "oldLangpackPath=Deprecated\old langpack\langpack_czech2.txt" & REM old langpack is searched in "langpacks\\" folder +if not "%~2" == "" ( + set "oldLangpackPath=%~2" + + if not exist "..\..\langpacks\%language%\%oldLangpackPath%" ( + echo ERROR: Old langpack file doesn't exists! + set err=1 + goto usage + ) +) + +:usage +if "%err%"=="1" ( + echo. + echo ======================== + echo Usage: refresh.bat language ["old langpack path"] + echo Note: path to old langpack must be relative to "langpacks\\" folder + echo. + echo Example 1: refresh.bat czech + echo Example 2: refresh.bat czech "Deprecated\old langpack\langpack_czech2.txt" + echo. + echo If you want own script in langpack dir, look at "langpacks\czech\refresh.bat" + echo ======================== + echo. + + pause + goto end +) REM ========================= -if "%useOldLangpack%" == "yes" ( +if defined "%oldLangpackPath%" ( set phase=0 ) else ( set phase=1 ) :start +echo Refreshing started... cd "..\..\tools\lpgen\" @@ -31,11 +73,11 @@ mkdir "Plugins" mkdir "Untranslated" if "%phase%" == "0" ( - REM load strings from old langpack - cscript /nologo translate.js /log:"yes" /out:"Plugins" /untranslated:"Untranslated" /outfile:"langpack_%language%.txt" /path:"..\..\langpacks\%language%\Plugins" /core:"..\..\langpacks\%language%\=CORE=.txt" /langpack:"..\..\langpacks\%language%\%oldLangpackPath%" + echo Loading strings from old langpack... + cscript /nologo translate.js /out:"Plugins" /untranslated:"Untranslated" /outfile:"langpack_%language%.txt" /path:"..\..\langpacks\%language%\Plugins" /core:"..\..\langpacks\%language%\=CORE=.txt" /langpack:"..\..\langpacks\%language%\%oldLangpackPath%" ) else ( REM load strings from recently created langpack (also to distribute strings between files) - cscript /nologo translate.js /log:"yes" /out:"Plugins" /untranslated:"Untranslated" /outfile:"langpack_%language%.txt" /path:"..\..\langpacks\%language%\Plugins" /core:"..\..\langpacks\%language%\=CORE=.txt" /langpack:"..\..\langpacks\%language%\Langpack_%language%.txt" + cscript /nologo translate.js /out:"Plugins" /untranslated:"Untranslated" /outfile:"langpack_%language%.txt" /path:"..\..\langpacks\%language%\Plugins" /core:"..\..\langpacks\%language%\=CORE=.txt" /langpack:"..\..\langpacks\%language%\Langpack_%language%.txt" ) rm -r "../../langpacks/%language%/Plugins" @@ -57,13 +99,13 @@ rm "Langpack_%language%.txt" cd "..\..\langpacks\tool\" LangpackSuite.exe \q \p%language% -if "%phase%" == "1" ( - goto end -) else ( +if not "%phase%" == "1" ( + echo Loading strings from new langpack... set "phase=1" goto start ) :end +echo Refreshing finished! REM ========================= \ No newline at end of file -- cgit v1.2.3