From 09e29473ed87afc9784efe245decad56fe12430e Mon Sep 17 00:00:00 2001 From: Maxim Ganetsky Date: Wed, 11 Aug 2021 02:17:53 +0300 Subject: [PATCH] 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). (cherry picked from commit a2daac1ca82bfdae59a61cc3b1a1bf996c4afd78) --- localize.bat | 28 +++------------------------- localize.sh | 40 ++++------------------------------------ 2 files changed, 7 insertions(+), 61 deletions(-) diff --git a/localize.bat b/localize.bat index aa97b08e3c..b16f53477f 100644 --- a/localize.bat +++ b/localize.bat @@ -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 diff --git a/localize.sh b/localize.sh index 7d64be148b..96bffca34f 100755 --- a/localize.sh +++ b/localize.sh @@ -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