File tree 2 files changed +46
-1
lines changed
2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+ use XML::Simple;
4
+ use Data::Dumper;
5
+
6
+ die " usage: $0 source.ts dest.cpp\n " unless @ARGV ==2 && -f $ARGV [0];
7
+
8
+ my $xml = XMLin($ARGV [0], ForceArray => 1);
9
+
10
+ open F, " >$ARGV [1]" ;
11
+
12
+ print F <<EOF ;
13
+ /*
14
+ This is NOT a proper c++ source code. This file is only designed to be caught
15
+ by qmake and included in lupdate. It contains all translateable strings collected
16
+ by pylupdate4.
17
+ */
18
+
19
+ EOF
20
+
21
+ die " context expected" unless exists $xml -> {context };
22
+
23
+ foreach my $context ( @{ $xml -> {context } } ) {
24
+ print F " \n // context: $context ->{name}->[0]\n\n " ;
25
+
26
+ foreach my $message ( @{ $context -> {message } } ) {
27
+ $message -> {source }-> [0] =~ s / "/ \\ "/ g ;
28
+ $message -> {source }-> [0] =~ s /\n / \\ n/ g ;
29
+
30
+ print F " translate( \" $context ->{name}->[0]\" , \" $message ->{source}->[0]\" );\n " ;
31
+ }
32
+ }
33
+
34
+ close F;
Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
# Update the translation files with strings used in QGIS
3
3
# 1. create a clean Qt .pro file for the project
4
4
# 2. run lupdate using the .pro file from step 1
@@ -14,10 +14,21 @@ PATH=$QTDIR/bin:$PATH
14
14
echo Creating qt_ts.tar
15
15
tar -cvf i18n/qt_ts.tar i18n/qt_* .ts
16
16
rm i18n/qt_* .ts
17
+ echo Updating python plugin translations
18
+ P=$PWD
19
+ for i in python/plugins/* /.; do
20
+ cd $i
21
+ pylupdate4 $( find . -name " *.py" ) -ts i18n.ts
22
+ perl $P /scripts/ts2cpp.pl i18n.ts i18n.cpp
23
+ rm i18n.ts
24
+ cd ../../..
25
+ done
17
26
echo Creating qmake project file
18
27
qmake -project -o qgis_ts.pro
19
28
echo Updating translation files
20
29
lupdate -verbose qgis_ts.pro
30
+ echo Removing temporary python plugin translation files
31
+ rm python/plugins/* /i18n.cpp
21
32
echo Removing qmake project file
22
33
rm qgis_ts.pro
23
34
echo Unpacking qt_ts.tar
You can’t perform that action at this time.
0 commit comments