summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2012-11-19 15:01:27 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-20 17:10:37 +0100
commitefadf302266bdeb8324f4673ce23480e67ee2996 (patch)
tree6695b24c1e456c088f1d70b17d43e4d19670c739
parente03b20c05bb7492e95e35bc4007a669c96307909 (diff)
downloadqttranslations-efadf302266bdeb8324f4673ce23480e67ee2996.tar.gz
modularize translations
this includes a script to modularize the old qt_??.ts files. Change-Id: I0fff36be18f5a9764d3ab1d2ee73e53cac43b979 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rwxr-xr-xtranslations/check-ts.pl6
-rw-r--r--translations/check-ts.xq2
-rwxr-xr-xtranslations/split-qt-ts.pl73
-rw-r--r--translations/translations.pro55
4 files changed, 109 insertions, 27 deletions
diff --git a/translations/check-ts.pl b/translations/check-ts.pl
index 55ccdec..2c2d553 100755
--- a/translations/check-ts.pl
+++ b/translations/check-ts.pl
@@ -43,7 +43,11 @@
use strict;
-my @groups = ("qt", "assistant", "designer", "linguist", "qt_help", "qtconfig", "qvfb");
+my @groups = (
+ "qtbase", "qtdeclarative", "qtxmlpatterns", "qtmultimedia", "qtscript", "qtquick1",
+# "qtdocgallery", "qtlocation", "qtpim", "qtsystems",
+ "assistant", "designer", "linguist", "qt_help", "qtconfig", "qmlviewer"
+);
my %scores = ();
my %langs = ();
diff --git a/translations/check-ts.xq b/translations/check-ts.xq
index 1062e90..2d6404c 100644
--- a/translations/check-ts.xq
+++ b/translations/check-ts.xq
@@ -1,3 +1,3 @@
for $file in tokenize($files, codepoints-to-string(10))
- let $fresh := doc($file)/TS/context[not (name = 'QtXmlPatterns')]/message[not (translation/@type = 'obsolete')]
+ let $fresh := doc($file)/TS/context/message[not (translation/@type = 'obsolete')]
return concat($file, ":", count($fresh/translation[not (@type = 'unfinished')]) * 100 idiv count($fresh))
diff --git a/translations/split-qt-ts.pl b/translations/split-qt-ts.pl
new file mode 100755
index 0000000..a8e6563
--- /dev/null
+++ b/translations/split-qt-ts.pl
@@ -0,0 +1,73 @@
+#! /usr/bin/perl -w
+#############################################################################
+##
+## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the translations module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+
+use strict;
+
+my @catalogs = ( "qtbase", "qtscript", "qtquick1", "qtmultimedia", "qtxmlpatterns" );
+
+die "Usage: $0 <locale> [<builddir>]\n" if (@ARGV != 1 && @ARGV != 2);
+my $lang = $ARGV[0];
+my $lupdate = "lupdate -locations relative -no-ui-lines";
+$lupdate .= " -pro-out $ARGV[1]" if (@ARGV == 2);
+
+for my $cat (@catalogs) {
+ system("$lupdate ../../$cat/src/src.pro qt_$lang.ts -ts ${cat}_$lang.ts") and die;
+}
+# qtdeclarative is special: we import it, but it's not part of the meta catalog
+system("$lupdate ../../qtdeclarative/src/src.pro qt_$lang.ts -ts qtdeclarative_$lang.ts") and die;
+
+open META, "> qt_$lang.ts" or die;
+print META <<EOF ;
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="C">
+ <dependencies>
+EOF
+for my $cat (@catalogs) {
+ print META " <dependency catalog=\"${cat}_$lang\"/>\n";
+}
+print META <<EOF ;
+ </dependencies>
+</TS>
+EOF
+close META or die;
diff --git a/translations/translations.pro b/translations/translations.pro
index cd60a0a..03b1279 100644
--- a/translations/translations.pro
+++ b/translations/translations.pro
@@ -10,7 +10,8 @@ TS_TARGETS =
# meta target name, target name, lupdate base options, files
defineTest(addTsTarget) {
cv = $${2}.commands
- $$cv = cd $$QT_SOURCE_TREE/src && $$LUPDATE $$3 -ts $$4
+ dir = $$section(PWD, /, 0, -3)
+ $$cv = cd $$dir && $$LUPDATE -pro-out $$shadowed($$dir) $$3 -ts $$4
export($$cv)
dv = $${1}.depends
$$dv += $$2
@@ -30,31 +31,35 @@ defineTest(addTsTargets) {
addTsTarget(ts-all, ts-$$1-all, $$2, $$PWD/$${1}_untranslated.ts $$files)
}
-addTsTargets(qt, -I../include -I../include/Qt \
- 3rdparty/phonon \
- 3rdparty/webkit \
- activeqt \
- corelib \
- declarative \
- gui \
- multimedia \
- network \
- opengl \
- plugins \
- qt3support \
- script \
- scripttools \
- sql \
- svg \
- xml \
- xmlpatterns \
+addTsTargets(qtbase, qtbase/src/src.pro \
+ qtactiveqt/src/src.pro \ # just 4 strings from QAxSelect
+ qtimageformats/src/src.pro \ # just 10 error messages from tga reader. uses bad context.
)
-addTsTargets(designer, ../tools/designer/designer.pro)
-addTsTargets(linguist, ../tools/linguist/linguist.pro)
-addTsTargets(assistant, ../tools/assistant/tools/tools.pro)
-addTsTargets(qt_help, ../tools/assistant/lib/lib.pro)
-addTsTargets(qtconfig, ../tools/qtconfig/qtconfig.pro)
-addTsTargets(qmlviewer, ../tools/qml/qml.pro)
+addTsTargets(qtdeclarative, qtdeclarative/src/src.pro)
+addTsTargets(qtmultimedia, qtmultimedia/src/src.pro)
+addTsTargets(qtquick1, qtquick1/src/src.pro)
+addTsTargets(qtscript, qtscript/src/src.pro)
+#addTsTargets(qtsvg, qtsvg/src/src.pro) # empty
+addTsTargets(qtxmlpatterns, qtxmlpatterns/src/src.pro)
+#addTsTargets(qtwebkit, qtwebkit/WebKit.pro) # messages from test browser only
+
+#addTsTargets(qt3d, qt3d/src/src.pro) # empty except one dubious error message
+#addTsTargets(qtconnectivity, qtconnectivity/src/src.pro) # just 2 error messages
+#addTsTargets(qtdocgallery, qtdocgallery/src/src.pro) # dead module
+#addTsTargets(qtfeedback, qtfeedback/src/src.pro) # empty
+#addTsTargets(qtjsondb, qtjsondb/src/src.pro) # dead module, just 3 error messages
+#addTsTargets(qtlocation, qtlocation/src/src.pro) # not part of 5.0
+#addTsTargets(qtpim, qtpim/src/src.pro) # not part of 5.0
+#addTsTargets(qtsensors, qtsensors/src/src.pro) # empty
+#addTsTargets(qtsystems, qtsystems/src/src.pro) # not part of 5.0
+
+addTsTargets(designer, qttools/src/designer/designer.pro)
+addTsTargets(linguist, qttools/src/linguist/linguist.pro)
+addTsTargets(assistant, qttools/src/assistant/assistant.pro) # add qcollectiongenerator here as well?
+addTsTargets(qt_help, qttools/src/assistant/help/help.pro)
+addTsTargets(qtconfig, qttools/src/qtconfig/qtconfig.pro)
+addTsTargets(qmlviewer, qtquick1/tools/qml/qml.pro)
+#addTsTargets(qmlscene, qtdeclarative/tools/qmlscene/qmlscene.pro) # almost empty due to missing tr()
check-ts.commands = (cd $$PWD && perl check-ts.pl)
check-ts.depends = ts-all