~ubuntu-branches/ubuntu/quantal/qtmobility/quantal

« back to all changes in this revision

Viewing changes to translations/check-ts.pl

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-16 16:18:07 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101116161807-k2dzt2nyse975r3l
Tags: 1.1.0-0ubuntu1
* New upstream release
* Syncronise with Debian, no remaining changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/perl -w
 
2
#############################################################################
 
3
##
 
4
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 
5
## All rights reserved.
 
6
## Contact: Nokia Corporation (qt-info@nokia.com)
 
7
##
 
8
## This file is part of the Qt Mobility Components.
 
9
##
 
10
## $QT_BEGIN_LICENSE:LGPL$
 
11
## Commercial Usage
 
12
## Licensees holding valid Qt Commercial licenses may use this file in 
 
13
## accordance with the Qt Commercial License Agreement provided with
 
14
## the Software or, alternatively, in accordance with the terms
 
15
## contained in a written agreement between you and Nokia.
 
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
## GNU General Public License Usage
 
30
## Alternatively, this file may be used under the terms of the GNU
 
31
## General Public License version 3.0 as published by the Free Software
 
32
## Foundation and appearing in the file LICENSE.GPL included in the
 
33
## packaging of this file.  Please review the following information to
 
34
## ensure the GNU General Public License version 3.0 requirements will be
 
35
## met: http://www.gnu.org/copyleft/gpl.html.
 
36
##
 
37
## If you are unsure which license is appropriate for your use, please
 
38
## contact the sales department at qt-sales@nokia.com.
 
39
## $QT_END_LICENSE$
 
40
##
 
41
#############################################################################
 
42
 
 
43
 
 
44
use strict;
 
45
 
 
46
my %scores = ();
 
47
 
 
48
my $files = join("\n", <*_??.ts>);
 
49
my $res = `xmlpatterns -param files=\"$files\" check-ts.xq`;
 
50
for my $i (split(/ /, $res)) {
 
51
  $i =~ /^(?:[^\/]+\/)*qtmobility_(..)\.ts:(.*)$/;
 
52
  my ($lang, $pc) = ($1, $2);
 
53
  $scores{$lang} = $pc;
 
54
}
 
55
 
 
56
my $code = "";
 
57
 
 
58
for my $lang (sort(keys(%scores))) {
 
59
  my $pc = $scores{$lang};
 
60
  my $fail = "";
 
61
  if (int($pc) < 98) {
 
62
    $fail = "    (excluded)";
 
63
  } else {
 
64
    $code .= " ".$lang;
 
65
  }
 
66
  printf "%-5s %3d%s\n", $lang, $pc, $fail;
 
67
}
 
68
 
 
69
my $fn = "translations.pro";
 
70
my $nfn = $fn."new";
 
71
open IN, $fn or die;
 
72
open OUT, ">".$nfn or die;
 
73
while (1) {
 
74
  $_ = <IN>;
 
75
  last if (/^LANGUAGES /);
 
76
  print OUT $_;
 
77
}
 
78
while ($_ =~ /\\\n$/) {
 
79
  $_ = <IN>;
 
80
}
 
81
print OUT "LANGUAGES =".$code."\n";
 
82
while (<IN>) {
 
83
  print OUT $_;
 
84
}
 
85
close OUT;
 
86
close IN;
 
87
rename $nfn, $fn;