OSDN Git Service

add contrib dir
[tortoisegit/TortoiseGitJp.git] / contrib / other / translation-status / TranslationStatus.bat
diff --git a/contrib/other/translation-status/TranslationStatus.bat b/contrib/other/translation-status/TranslationStatus.bat
new file mode 100644 (file)
index 0000000..9e3400f
--- /dev/null
@@ -0,0 +1,167 @@
+@echo off\r
+rem Copyright (C) 2004-2008 the TortoiseSVN team\r
+rem This file is distributed under the same license as TortoiseSVN\r
+\r
+rem Last commit by:\r
+rem $Author: luebbe $\r
+rem $Date: 2008-09-29 19:22:31 +0800 (Mon, 29 Sep 2008) $\r
+rem $Rev: 14138 $\r
+\r
+rem Script to calculate the GUI and DOC translation status report for TortoiseSVN\r
+\r
+SETLOCAL ENABLEDELAYEDEXPANSION\r
+\r
+rem Trunk and branch location. \r
+rem Without slash, because they're not only used for directories\r
+set Trunk=trunk\r
+set Brnch=branches\1.5.x\r
+\r
+rem Paths & working directories\r
+set ScriptPath=%~dp0\r
+set RootDir=..\..\..\..\\r
+set LanguageList=%RootDir%%Trunk%\Languages\Languages.txt\r
+\r
+rem Some blanks for formatting\r
+set Blanks30="                              "\r
+set Sep75============================================================================\r
+\r
+rem Get current revision of working copy\r
+for /F "usebackq" %%p in (`svnversion`) do set WCRev=%%p\r
+\r
+rem ----------------------------------------\r
+rem Set parameters for gui translation\r
+rem ----------------------------------------\r
+set WDirTrunk=%RootDir%%Trunk%\Languages\r
+set WDirBrnch=%RootDir%%Brnch%\Languages\r
+set LogFile=%ScriptPath%\gui_translation.txt\r
+\r
+echo.> %LogFile%\r
+echo TortoiseSVN GUI translation status for revision !WCRev:~0,5!^ >> %LogFile%\r
+\r
+echo.>> %LogFile%\r
+call :CheckTranslation Tortoise TortoiseGUI\r
+\r
+\r
+rem ----------------------------------------\r
+rem Set parameters for doc translation\r
+rem ----------------------------------------\r
+set WDirTrunk=%RootDir%%Trunk%\doc\po\r
+set WDirBrnch=%RootDir%%Brnch%\doc\po\r
+set LogFile=%ScriptPath%\doc_translation.txt\r
+\r
+echo.> %LogFile%\r
+echo TortoiseSVN DOC translation status for revision !WCRev:~0,5!^ >> %LogFile%\r
+\r
+echo.>> %LogFile%\r
+call :CheckTranslation TortoiseSVN TortoiseSVN\r
+\r
+echo.>> %LogFile%\r
+echo.>> %LogFile%\r
+call :CheckTranslation TortoiseMerge TortoiseMerge\r
+\r
+ENDLOCAL\r
+Exit /b 0\r
+rem End of Program\r
+rem ########################################\r
+\r
+\r
+:CheckTranslation\r
+rem ----------------------------------------------------------------------\r
+rem Subroutine to check the translation status \r
+rem %1 = Name of po/pot files\r
+rem %2 = Caption for log file\r
+rem ----------------------------------------------------------------------\r
+\r
+call :Prepare %WDirTrunk% %1 trunk\r
+set TotalTrunk=%Errorlevel%\r
+call :Prepare %WDirBrnch% %1 branch\r
+set TotalBrnch=%Errorlevel%\r
+\r
+set Cap=%2 %Sep75%\r
+set Cap=!Cap:~0,75!\r
+echo !Cap! >> %LogFile%\r
+\r
+rem Write log file header \r
+echo                                : Developer Version   : Current Release >> %LogFile%\r
+echo                  Location      : %Trunk%               : %Brnch% >> %LogFile%\r
+echo                  Total strings : %TotalTrunk%                : %TotalBrnch% >> %LogFile%\r
+echo Language                       : Status (fu/un/ma)   : Status (fu/un/ma) >> %LogFile% \r
+echo =========================================================================== >> %LogFile%\r
+\r
+rem Let's loop through all trunk translations.\r
+rem Don't care if there's a language more on the release branch (dead language anyway)  \r
+rem !!! ATTENTION \r
+rem !!! There is a real TAB key inside "delims=        ;"\r
+rem !!! Please leave it there\r
+\r
+for /F "eol=# delims=  ; tokens=1,5" %%i in (%LanguageList%) do (\r
+  set PoFile=%1_%%i.po\r
+  set LangName=%%j ^(%%i^)%Blanks30:~1,30%\r
+  set LangName=!LangName:~0,30!\r
+\r
+  if exist trunk\!PoFile! (\r
+    echo Computing Status for !LANGNAME!\r
+    for /F "usebackq delims=#" %%p in (`Check_Status.bat trunk !PoFile! !TotalTrunk!`) do set StatusTrunk=%%p\r
+    for /F "usebackq delims=#" %%p in (`Check_Status.bat branch !PoFile! !TotalBrnch!`) do set StatusBrnch=%%p\r
+    echo !LANGNAME! : !StatusTrunk! : !StatusBrnch! >> %Logfile%\r
+  )\r
+)\r
+\r
+rem Write log file footer \r
+echo =========================================================================== >> %LogFile%\r
+echo Status: fu=fuzzy - un=untranslated - ma=missing accelerator keys >> %LogFile%\r
+echo =========================================================================== >> %LogFile%\r
+\r
+call :Cleanup %1 trunk\r
+call :Cleanup %1 branch\r
+\r
+exit /b 0\r
+rem End:CheckTranslation\r
+rem ----------------------------------------------------------------------\r
+\r
+\r
+:Prepare\r
+rem ----------------------------------------------------------------------\r
+rem Subroutine to prepare the working directory for the check \r
+rem %1 = Source dir\r
+rem %2 = File name(s) to copy\r
+rem %3 = Dest dir\r
+rem Return number of strings in errorlevel\r
+rem ----------------------------------------------------------------------\r
+echo.\r
+echo Preparing working directory %2 %3\r
+echo ----------------------------------------------------------------------\r
+\r
+copy %1\%2*.po %3 /Y 1>NUL\r
+copy %1\%2.pot %3 /Y 1>NUL\r
+\r
+pushd %3\r
+\r
+FOR /F "usebackq" %%p IN (`%ScriptPath%\Check_Attrib.bat %2.pot`) DO SET StringsTotal=%%p\r
+\r
+FOR %%i in (%2*.po) DO (\r
+  echo %%i\r
+  msgmerge --no-wrap --quiet --no-fuzzy-matching -s %%i %2.pot -o %%i 2> NUL\r
+)\r
+popd\r
+\r
+exit /b !StringsTotal!\r
+rem End:Prepare\r
+rem ----------------------------------------------------------------------\r
+\r
+\r
+:Cleanup\r
+rem ----------------------------------------------------------------------\r
+rem Subroutine to clean up the working directory after the check \r
+rem %1 = File name(s) to delete\r
+rem %2 = Directory\r
+rem ----------------------------------------------------------------------\r
+echo Cleaning up working directory %1 %2\r
+pushd %2\r
+del %1*.po /Q 2>Nul\r
+del %1.pot /Q 2>Nul\r
+del %1*.mo /Q 2>Nul\r
+popd\r
+exit /b 0\r
+rem End:Cleanup\r
+rem ----------------------------------------------------------------------\r