1#!/usr/bin/env bash 2# 3# Usage: sh localize.sh 4# 5# This script should be executed after adding new resource strings and after 6# udating the translated .po files. 7# 8# This script 9# - converts all compiled .rst files to .po files, 10# - updates all translated xx.po files 11# 12 13# enable for debugging 14#set -x 15set -e 16 17if [ ! -x tools/updatepofiles ]; then 18 cd tools 19 make updatepofiles 20 cd - 21fi 22 23if [ "@"$FPCTARGET == "@" ]; then 24 FPCTARGET=`fpc -iTP`-`fpc -iTO` 25 if [ $FPCTARGET == "-" ]; then 26 FPCTARGET="" 27 fi 28fi 29 30RSEXT="rst" 31FPCVER=`fpc -iV` 32if [ "$FPCVER" \> "2.7.0" ]; then 33 RSEXT="rsj" 34fi 35 36RSTFILES=( 37 ". lazarusidestrconsts lazaruside" 38 ". debuggerstrconst" 39) 40 41set -x 42 43for idx in ${!RSTFILES[@]}; do 44 LINE=(${RSTFILES[idx]}) 45 RSTDIR=${LINE[0]} 46 RSTFILE=${LINE[1]} 47 POFILE=${LINE[2]:-$RSTFILE} 48 49 RST=$(find $RSTDIR -name $RSTFILE.$RSEXT) 50 if [ -n "$RST" ]; then 51 RST=`find $RSTDIR -name $RSTFILE.$RSEXT | xargs ls -1t | head -1`; 52 53 if [ -n "$RST" ]; then 54 POFileFull=$RSTDIR/languages/$POFILE.po 55 56 ./tools/updatepofiles $RST $POFileFull 57 58 fi 59 fi 60done 61 62exit 0 63