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
REM
REM Make sure you have your setings correctly
REM
REM Usage: localize
REM
REM This script should be executed after adding new resource strings and after
REM udating the translated .po files.
REM
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
REM set LazInstall=C:\lazarus\
set ArchOS=i386-win32
set ArchOsWS=%ArchOS%\win32
echo.
REM Compile tools if updatepofiles is missing
@ -36,27 +30,11 @@ echo.
echo on
@echo Updating IDE
@set IDE_RSJ=units\%ArchOsWS%\LazarusIDEStrConsts.rsj
@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
@tools\updatepofiles --searchdir=units lazarusidestrconsts.rsj languages\lazaruside.pot
@echo.
@echo Updating Debugger dialogs
@set DBGD_RSJ=units\%ArchOsWS%\DebuggerStrConst.rsj
@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
@tools\updatepofiles --searchdir=units debuggerstrconst.rsj languages\debuggerstrconst.pot
@echo.
@goto Exit

View File

@ -6,7 +6,7 @@
# udating the translated .po files.
#
# This script
# - converts all compiled .rst files to .pot files,
# - converts all compiled .rsj files to .pot files,
# - updates all translated xx.po files
#
@ -20,43 +20,11 @@ if [ ! -x tools/updatepofiles ]; then
cd -
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"
fi
RSTFILES=(
". lazarusidestrconsts lazaruside"
". debuggerstrconst"
)
RSEXT="rsj"
set -x
for idx in ${!RSTFILES[@]}; do
LINE=(${RSTFILES[idx]})
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
./tools/updatepofiles --searchdir=./units lazarusidestrconsts.$RSEXT ./languages/lazaruside.pot
./tools/updatepofiles --searchdir=./units debuggerstrconst.$RSEXT ./languages/debuggerstrconst.pot
exit 0