Debian Codegraph @

translations/split-qt-ts.pl

raw
1 #! /usr/bin/perl -w
2 #############################################################################
3 ##
4 ## Copyright (C) 2017 The Qt Company Ltd.
5 ## Contact: https://www.qt.io/licensing/
6 ##
7 ## This file is part of the translations module of the Qt Toolkit.
8 ##
9 ## $QT_BEGIN_LICENSE:GPL-EXCEPT$
10 ## Commercial License Usage
11 ## Licensees holding valid commercial Qt licenses may use this file in
12 ## accordance with the commercial license agreement provided with the
13 ## Software or, alternatively, in accordance with the terms contained in
14 ## a written agreement between you and The Qt Company. For licensing terms
15 ## and conditions see https://www.qt.io/terms-conditions. For further
16 ## information use the contact form at https://www.qt.io/contact-us.
17 ##
18 ## GNU General Public License Usage
19 ## Alternatively, this file may be used under the terms of the GNU
20 ## General Public License version 3 as published by the Free Software
21 ## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
22 ## included in the packaging of this file. Please review the following
23 ## information to ensure the GNU General Public License requirements will
24 ## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25 ##
26 ## $QT_END_LICENSE$
27 ##
28 #############################################################################
29
30
31 use strict;
32
33 my @catalogs = ( "qtbase", "qtscript", "qtmultimedia", "qtxmlpatterns" );
34
35 die "Usage: $0 <locale> [<builddir>]\n" if (@ARGV != 1 && @ARGV != 2);
36 my $lang = $ARGV[0];
37 my $lupdate = "lupdate -locations relative -no-ui-lines";
38 $lupdate .= " -pro-out $ARGV[1]" if (@ARGV == 2);
39
40 for my $cat (@catalogs) {
41 my $extra = "";
42 $extra = " ../../qtactiveqt/src/src.pro ../../qtimageformats/src/src.pro" if ($cat eq "qtbase");
43 system("$lupdate ../../$cat/src/src.pro$extra -xts qt_$lang.ts -ts ${cat}_$lang.ts") and die;
44 }
45 # qtdeclarative is special: we import it, but it is not part of the meta catalog
46 system("$lupdate ../../qtdeclarative/src/src.pro -xts qt_$lang.ts -ts qtdeclarative_$lang.ts") and die;
47
48 open META, "> qt_$lang.ts" or die;
49 print META <<EOF ;
50 <?xml version="1.0" encoding="utf-8"?>
51 <!DOCTYPE TS>
52 <TS version="2.0" language="$lang">
53 <dependencies>
54 EOF
55 for my $cat (@catalogs) {
56 print META " <dependency catalog=\"${cat}_$lang\"/>\n";
57 }
58 print META <<EOF ;
59 </dependencies>
60 </TS>
61 EOF
62 close META or die;