author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/env perl |
2 |
############################################################################# |
|
3 |
## |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4 |
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 5 |
## All rights reserved. |
6 |
## Contact: Nokia Corporation (qt-info@nokia.com) |
|
7 |
## |
|
8 |
## This file is part of the test suite of the Qt Toolkit. |
|
9 |
## |
|
10 |
## $QT_BEGIN_LICENSE:LGPL$ |
|
11 |
## No Commercial Usage |
|
12 |
## This file contains pre-release code and may not be distributed. |
|
13 |
## You may use this file in accordance with the terms and conditions |
|
14 |
## contained in the Technology Preview License Agreement accompanying |
|
15 |
## this package. |
|
16 |
## |
|
17 |
## GNU Lesser General Public License Usage |
|
18 |
## Alternatively, this file may be used under the terms of the GNU Lesser |
|
19 |
## General Public License version 2.1 as published by the Free Software |
|
20 |
## Foundation and appearing in the file LICENSE.LGPL included in the |
|
21 |
## packaging of this file. Please review the following information to |
|
22 |
## ensure the GNU Lesser General Public License version 2.1 requirements |
|
23 |
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
24 |
## |
|
25 |
## In addition, as a special exception, Nokia gives you certain additional |
|
26 |
## rights. These rights are described in the Nokia Qt LGPL Exception |
|
27 |
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
28 |
## |
|
29 |
## If you have questions regarding the use of this file, please contact |
|
30 |
## Nokia at qt-info@nokia.com. |
|
31 |
## |
|
32 |
## |
|
33 |
## |
|
34 |
## |
|
35 |
## |
|
36 |
## |
|
37 |
## |
|
38 |
## |
|
39 |
## $QT_END_LICENSE$ |
|
40 |
## |
|
41 |
############################################################################# |
|
42 |
||
43 |
sub makeit2($$$) |
|
44 |
{ |
|
45 |
for (my $i = 0; $i < (1 << $_[0]); $i++) { |
|
46 |
print OUTFILE "\n"; |
|
47 |
print OUTFILE "$_[2]\n" unless $3 eq ""; |
|
48 |
print OUTFILE "msgid \"singular $_[1] $i\"\n"; |
|
49 |
print OUTFILE "msgid_plural \"plural $_[1] $i\"\n"; |
|
50 |
for (my $j = 0; $j < $_[0]; $j++) { |
|
51 |
my $tr; |
|
52 |
if (($i & (1 << $j)) == 0) { |
|
53 |
$tr = "translated $_[1] $i $j"; |
|
54 |
} |
|
55 |
print OUTFILE "msgstr[$j] \"$tr\"\n"; |
|
56 |
} |
|
57 |
} |
|
58 |
} |
|
59 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
60 |
sub makeit($$$) |
0 | 61 |
{ |
62 |
open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR"; |
|
63 |
print OUTFILE <<EOF; |
|
64 |
msgid "" |
|
65 |
msgstr "" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
66 |
"MIME-Version: 1.0\\n" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
67 |
"Content-Type: text/plain; charset=UTF-8\\n" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
68 |
"Content-Transfer-Encoding: 8bit\\n" |
0 | 69 |
"X-FooBar: yup\\n" |
70 |
"X-Language: $_[1]\\n" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
71 |
"Plural-Forms: $_[2]\\n" |
0 | 72 |
EOF |
73 |
makeit2($_[0], "one", ""); |
|
74 |
makeit2($_[0], "two", "#, fuzzy |
|
75 |
#| msgid \"old untranslated one\""); |
|
76 |
makeit2($_[0], "three", "#, fuzzy |
|
77 |
#| msgid \"old untranslated two\" |
|
78 |
#| msgid_plural \"old untranslated plural two\""); |
|
79 |
makeit2($_[0], "four", "#, fuzzy |
|
80 |
#| msgid_plural \"old untranslated only plural three\""); |
|
81 |
} |
|
82 |
||
83 |
$OUTDIR = $ARGV[0]; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
84 |
makeit(1, "zh_CN", "nplurals=1; plural=0;"); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
85 |
makeit(2, "de_DE", "nplurals=2; plural=(n != 1);"); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
86 |
makeit(3, "pl_PL", "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"); |