File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
22# Update the translation files with strings used in QGIS
33# 1. create a clean Qt .pro file for the project
44# 2. run lupdate using the .pro file from step 1
@@ -14,10 +14,21 @@ PATH=$QTDIR/bin:$PATH
1414echo Creating qt_ts.tar
1515tar -cvf i18n/qt_ts.tar i18n/qt_* .ts
1616rm 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
1726echo Creating qmake project file
1827qmake -project -o qgis_ts.pro
1928echo Updating translation files
2029lupdate -verbose qgis_ts.pro
30+ echo Removing temporary python plugin translation files
31+ rm python/plugins/* /i18n.cpp
2132echo Removing qmake project file
2233rm qgis_ts.pro
2334echo Unpacking qt_ts.tar
You can’t perform that action at this time.
0 commit comments