IDE: Now that updatepofiles tool is able to search for .rsj files, greatly simplified localize scripts (and made Windows script target agnostic). While at this, removed .rst file handling (relevant only for pre FPC 2.6.x and older compilers).

This commit is contained in:
Maxim Ganetsky 2021-08-11 02:17:53 +03:00
parent 8d7e9e30ff
commit a2daac1ca8
2 changed files with 7 additions and 61 deletions

View File

@ -1,21 +1,15 @@
@echo off @echo off
REM REM
REM Make sure you have your setings correctly
REM
REM Usage: localize REM Usage: localize
REM REM
REM This script should be executed after adding new resource strings and after REM This script should be executed after adding new resource strings and after
REM udating the translated .po files. REM udating the translated .po files.
REM REM
REM This script REM This script
REM - converts all compiled .rsj (.rst if .rsj is not found) files to .pot files, REM - converts all compiled .rsj files to .pot files,
REM - updates all translated xx.po files REM - updates all translated xx.po files
REM REM
REM set LazInstall=C:\lazarus\
set ArchOS=i386-win32
set ArchOsWS=%ArchOS%\win32
echo. echo.
REM Compile tools if updatepofiles is missing REM Compile tools if updatepofiles is missing
@ -36,27 +30,11 @@ echo.
echo on echo on
@echo Updating IDE @echo Updating IDE
@set IDE_RSJ=units\%ArchOsWS%\LazarusIDEStrConsts.rsj @tools\updatepofiles --searchdir=units lazarusidestrconsts.rsj languages\lazaruside.pot
@if exist %IDE_RSJ% goto IDE_update
@echo RSJ file NOT found. Searching for RST.
@set IDE_RSJ=units\%ArchOsWS%\LazarusIDEStrConsts.rst
@if not exist %IDE_RSJ% goto SkipIDE
:IDE_update
@tools\updatepofiles %IDE_RSJ% languages\lazaruside.pot
@echo Translation file %IDE_RSJ% found.
:SkipIDE
@echo. @echo.
@echo Updating Debugger dialogs @echo Updating Debugger dialogs
@set DBGD_RSJ=units\%ArchOsWS%\DebuggerStrConst.rsj @tools\updatepofiles --searchdir=units debuggerstrconst.rsj languages\debuggerstrconst.pot
@if exist %DBGD_RSJ% goto DBGD_update
@echo RSJ file NOT found. Searching for RST.
@set DBGD_RSJ=units\%ArchOsWS%\DebuggerStrConst.rst
@if not exist %DBGD_RSJ% goto SkipDBGD
:DBGD_update
@tools\updatepofiles %DBGD_RSJ% languages\debuggerstrconst.pot
@echo Translation file %DBGD_RSJ% found.
:SkipDBGD
@echo. @echo.
@goto Exit @goto Exit

View File

@ -6,7 +6,7 @@
# udating the translated .po files. # udating the translated .po files.
# #
# This script # This script
# - converts all compiled .rst files to .pot files, # - converts all compiled .rsj files to .pot files,
# - updates all translated xx.po files # - updates all translated xx.po files
# #
@ -20,43 +20,11 @@ if [ ! -x tools/updatepofiles ]; then
cd - cd -
fi fi
if [ "@"$FPCTARGET == "@" ]; then
FPCTARGET=`fpc -iTP`-`fpc -iTO`
if [ $FPCTARGET == "-" ]; then
FPCTARGET=""
fi
fi
RSEXT="rst"
FPCVER=`fpc -iV`
if [ "$FPCVER" \> "2.7.0" ]; then
RSEXT="rsj" RSEXT="rsj"
fi
RSTFILES=(
". lazarusidestrconsts lazaruside"
". debuggerstrconst"
)
set -x set -x
for idx in ${!RSTFILES[@]}; do ./tools/updatepofiles --searchdir=./units lazarusidestrconsts.$RSEXT ./languages/lazaruside.pot
LINE=(${RSTFILES[idx]}) ./tools/updatepofiles --searchdir=./units debuggerstrconst.$RSEXT ./languages/debuggerstrconst.pot
RSTDIR=${LINE[0]}
RSTFILE=${LINE[1]}
POFILE=${LINE[2]:-$RSTFILE}
RST=$(find $RSTDIR -name $RSTFILE.$RSEXT)
if [ -n "$RST" ]; then
RST=`find $RSTDIR -name $RSTFILE.$RSEXT | xargs ls -1t | head -1`;
if [ -n "$RST" ]; then
POFileFull=$RSTDIR/languages/$POFILE.pot
./tools/updatepofiles $RST $POFileFull
fi
fi
done
exit 0 exit 0