Skip to content

Commit

Permalink
update translation scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 9, 2017
1 parent d4acdac commit 5ff6b14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion scripts/ts2cpp.pl
Expand Up @@ -14,13 +14,19 @@
# #
###########################################################################

use strict;
use warnings;
use Carp qw/croak/;
use XML::Simple;

$SIG{__WARN__} = sub { croak @_; };

die "usage: $0 source.ts dest.cpp\n" unless @ARGV==2 && -f $ARGV[0];

my $xml = XMLin($ARGV[0], ForceArray=>1);

open F, ">$ARGV[1]";
binmode(F, ":utf8");

print F <<EOF;
/*
Expand All @@ -46,7 +52,7 @@
$message->{comment}->[0] =~ s/"/\\"/g;
$message->{comment}->[0] =~ s/\n/\\n/g;

print F ",\"$context->{comment}->[0]\"";
print F ",\"$message->{comment}->[0]\"";
}

if( exists $message->{numerus} && $message->{numerus} eq "yes" ) {
Expand Down
10 changes: 8 additions & 2 deletions scripts/update_ts.sh
Expand Up @@ -46,6 +46,8 @@ cleanup() {
trap "" EXIT
}

export QT_SELECT=5

PATH=$QTDIR/bin:$PATH

if type qmake-qt5 >/dev/null 2>&1; then
Expand All @@ -70,7 +72,7 @@ if ! type tx >/dev/null 2>&1; then
exit 1
fi

builddir=$2
builddir=$(realpath $2)
if [ -d "$builddir" ]; then
textcpp=
for i in $builddir/src/core/qgsexpression_texts.cpp $builddir/src/core/qgscontexthelp_texts.cpp; do
Expand All @@ -96,6 +98,10 @@ tar --remove-files -cf i18n/backup.tar $files
if [ $1 = push ]; then
echo Pulling source from transifex...
tx pull -s -l none
if ! [ -f "i18n/qgis_en.ts" ]; then
echo Download of source translation failed
exit
fi
elif [ $1 = pull ]; then
rm i18n/qgis_*.ts

Expand Down Expand Up @@ -134,7 +140,7 @@ echo Updating processing translations
perl scripts/processing2cpp.pl python/plugins/processing/processing-i18n.cpp

echo Creating qmake project file
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n $textcpp
$QMAKE -project -o qgis_ts.pro -nopwd $PWD/src $PWD/python $PWD/i18n $textcpp

echo Updating translations
$LUPDATE -locations absolute -verbose qgis_ts.pro
Expand Down

0 comments on commit 5ff6b14

Please sign in to comment.