Skip to content

Commit 09a4f6f

Browse files
committed
i18n: fix it on windows (followup 2f431bc)
1 parent 75697d7 commit 09a4f6f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

scripts/ts2ui.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ sub xmlescape {
4949

5050
die "context expected" unless exists $xml->{context};
5151

52+
my $i = 0;
5253
foreach my $context ( @{ $xml->{context} } ) {
54+
$i++;
5355
my $name = $context->{name}->[0];
5456

55-
die "$ARGV[1]/$name-i18n.ui already exists" if -f "$ARGV[1]/$name-i18n.ui";
56-
open UI, ">$ARGV[1]/$name-i18n.ui";
57+
open UI, ">$ARGV[1]/$name-$i-i18n.ui";
5758
binmode(UI, ":utf8");
5859

5960
print UI <<EOF;

scripts/update_ts.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
set -e
1818

19+
export SRCDIR=$PWD
20+
1921
action=$1
2022

2123
case "$action" in
@@ -28,6 +30,8 @@ pull|push|update)
2830
esac
2931

3032
cleanup() {
33+
cd $SRCDIR
34+
3135
if [ -f i18n/backup.tar ]; then
3236
echo Restoring files...
3337
tar -xf i18n/backup.tar
@@ -36,7 +40,7 @@ cleanup() {
3640

3741
echo Removing temporary files
3842
rm -rf python/tmp python/plugins/processing/tmp python/plugins/*/tmp qgis_ts.pro
39-
find . \( -name "*-i18n.ui" -o -name numerus-i18n.cpp \) -delete
43+
find src python \( -name "*-i18n.ui" -o -name "*-i18n.cpp" -o -name "*-i18n.ts" \) -delete
4044

4145
trap "" EXIT
4246
}
@@ -45,6 +49,10 @@ export QT_SELECT=5
4549

4650
PATH=$QTDIR/bin:$PATH
4751

52+
if type cygpath >/dev/null 2>&1; then
53+
SRCDIR=$(cygpath -am $SRCDIR)
54+
fi
55+
4856
if type qmake-qt5 >/dev/null 2>&1; then
4957
QMAKE=qmake-qt5
5058
else
@@ -116,7 +124,7 @@ if [ $action = push ]; then
116124
cp i18n/qgis_en.ts /tmp/qgis_en.ts-downloaded
117125
perl scripts/ts-clear.pl # reset English translations
118126
elif [ $action = pull ]; then
119-
rm i18n/qgis_*.ts
127+
rm -f i18n/qgis_*.ts
120128

121129
echo Pulling new translations...
122130
if [ "$#" -gt 0 ]; then
@@ -163,12 +171,14 @@ mkdir -p python/plugins/processing/tmp
163171
perl scripts/processing2ui.pl python/plugins/processing/tmp
164172

165173
echo Updating appinfo files
166-
python scripts/appinfo2ui.py >src/app/appinfo-i18n.ui
174+
python3 scripts/appinfo2ui.py >src/app/appinfo-i18n.ui
167175

168176
echo Creating qmake project file
169-
$QMAKE -project -o qgis_ts.pro -nopwd $PWD/src $PWD/python $PWD/i18n $textcpp
177+
$QMAKE -project -o qgis_ts.pro -nopwd $SRCDIR/src $SRCDIR/python $SRCDIR/i18n $textcpp
178+
179+
QT_INSTALL_HEADERS=$(qmake -query QT_INSTALL_HEADERS)
170180

171-
echo "TR_EXCLUDE = $(qmake -query QT_INSTALL_HEADERS)/*" >>qgis_ts.pro
181+
echo "TR_EXCLUDE = ${QT_INSTALL_HEADERS%}/*" >>qgis_ts.pro
172182

173183
echo Updating translations
174184
$LUPDATE -no-ui-lines -no-obsolete -locations absolute -verbose qgis_ts.pro

0 commit comments

Comments
 (0)