Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/po_report.pl
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2005-03-04 23:30:22 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2005-03-04 23:30:22 (GMT)
commitb2eed7048940fb4c8ed657599adcc29940ac088d (patch)
tree01b0c1e7a4d742637720456678a51408a5b21e08 /po_report.pl
parente450d097a2cb89a68062103b67d718cffbf1e52c (diff)
created by Bruno, it's not gcompris specific. it is used to create status
* po_report.pl: created by Bruno, it's not gcompris specific. it is used to create status report of .po translations
Diffstat (limited to 'po_report.pl')
-rwxr-xr-xpo_report.pl190
1 files changed, 190 insertions, 0 deletions
diff --git a/po_report.pl b/po_report.pl
new file mode 100755
index 0000000..1b9fce8
--- /dev/null
+++ b/po_report.pl
@@ -0,0 +1,190 @@
+#!/usr/bin/perl
+# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
+#
+# The translation status from .po files
+#
+# Copyright (C) 2005 Free Software Foundation.
+#
+# Intltool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 published by the Free Software Foundation.
+#
+# Intltool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+#
+# Authors: Bruno Coudoin <bruno.coudoin@free.fr>
+#
+
+use strict;
+
+my %table_supported; # Supported languages (more than 80% strings translated).
+my %table_unsupported; # Partially supported languages (between 50% and 80%).
+my %table_partially; # Unsupported languages (less than 50%).
+
+# Update as needed
+my %COUNTRY = (
+ 'sq' => 'Albanian',
+ 'pt_BR' => 'Brazilian Portuguese',
+ 'en_GB' => 'British English',
+ 'en_CA' => 'Canadian English',
+ 'da' => 'Danish',
+ 'de' => 'German',
+ 'gu' => 'Gujarati',
+ 'pl' => 'Polish',
+ 'pa' => 'Punjabi',
+ 'es' => 'Spanish',
+ 'nl' => 'Dutch',
+ 'ja' => 'Japanese',
+ 'pt' => 'Portuguese',
+ 'cs' => 'Czech',
+ 'sr' => 'Serbian',
+ 'sr@Latn' => 'Serbian',
+ 'ta' => 'Tamil',
+ 'tr' => 'Turkish',
+ 'uk' => 'Ukrainian',
+ 'fi' => 'Finnish',
+ 'fr' => 'French',
+ 'sv' => 'Swedish',
+ 'zh_CN' => 'Chinese Simplified',
+ 'el' => 'Greek',
+ 'ar' => 'Arabic',
+ 'zh_TW' => 'Chinese Traditional',
+ 'ru' => 'Russian',
+ 'nb' => 'Norwegian Bookmal',
+ 'lt' => 'Lithuanian',
+ 'it' => 'Italian',
+ 'az' => 'Azerbaijani',
+ 'ko' => 'Korean',
+ 'bg' => 'Bulgarian',
+ 'bn' => 'Bengali',
+ 'hu' => 'Hungarian',
+ 'ca' => 'Catalan',
+ 'bs' => 'Bosnian',
+ 'cy' => 'Welsh',
+ 'ro' => 'Romanian',
+ 'id' => 'Indonesian',
+ 'hi' => 'Hindi',
+ 'eu' => 'Basque',
+ 'nn' => 'Norwegian Nynorsk',
+ 'vi' => 'Vietnamese',
+ 'ms' => 'Malay',
+ 'hr' => 'Croatian',
+ 'mn' => 'Mongolian',
+ 'sk' => 'Slovak',
+ 'mk' => 'Macedonian',
+ 'be' => 'Belarusian',
+ 'sl' => 'Slovenian',
+ 'he' => 'Hebrew',
+ 'et' => 'Estonian',
+ 'lv' => 'Latvian',
+ 'th' => 'Thai',
+ 'gl' => 'Galician',
+ 'ne' => 'Nepali',
+ 'fa' => 'Persian',
+ 'wa' => 'Wallon',
+ 'is' => 'Icelandic',
+ 'ga' => 'Irish Gaelic',
+ 'af' => 'Afrikaans',
+ 'ml' => 'Malayalam',
+ 'nso' => 'Northern Sotho',
+ 'am' => 'Amharic',
+ 'sr@ije' => 'Serbian Jekavian',
+ 'zu' => 'Zulu',
+ 'tk' => 'Turkmen',
+ 'li' => 'Limburgish',
+ 'or' => 'Oriya',
+ 'mr' => 'Marathi',
+ 'yi' => 'Yiddish',
+ 'eo' => 'Esperanto',
+ 'kn' => 'Kannada',
+ 'mi' => 'Maori',
+ 'xh' => 'Xhosa',
+ 'br' => 'Breton',
+ 'ka' => 'Georgian',
+ 'tg' => 'Tajik',
+ 'ang' => 'Old English',
+ 'yo' => 'Yoruba',
+ 'uz' => 'Uzbek',
+ 'uz@Latn' => 'Uzbek Latin',
+ 'en_AU' => 'Australian English',
+ 'as' => 'Assamese',
+ 'ia' => 'Interlingua',
+ 'az_IR' => 'Iranian Azerbaijani'
+ );
+
+
+
+print STDERR "Please WAIT, running 'cd po && ../intltool-update --report'\n";
+#my $report = `cd po && ../intltool-update --report 2>&1`;
+my $report = `export LC_ALL=C && cd po && cat report`;
+
+my @report_list = split("\n", $report);
+
+foreach my $line (@report_list) {
+ my ($locale) = $line =~ /(^[\w_\@]+):.*/;
+ if ($locale) {
+ my ($translated) = $line =~ /.*: (\d+) translated messages.*/;
+ my ($fuzzy) = $line =~ /.*:.* (\d+) fuzzy translations.*/;
+ my ($untranslated) = $line =~ /.*:.* (\d+) untranslated messages.*/;
+ if ($translated) {
+ my $percent = int((100-($untranslated+$fuzzy)/($translated+$untranslated+$fuzzy)*100));
+ $table_supported{$locale} = $percent if $percent >= 80;
+ $table_partially{$locale} = $percent if $percent >= 50 and $percent < 80;
+ $table_unsupported{$locale} = $percent if $percent < 50;
+ }
+ }
+}
+
+# Global counter for display_report
+my $counter = 1;
+
+
+sub display_report($$) {
+ my $title = shift;
+ my $table = shift;
+
+ my $previous_value = -1;
+
+ print "\n\n$title\n\n";
+
+ foreach my $key (sort { $table->{$b} <=> $table->{$a} } keys %{$table}) {
+ if ($previous_value != $table->{$key}) {
+ printf("%6s. %-40s %10s%\n", $counter, "$COUNTRY{$key} ($key)", $table->{$key});
+ } else {
+ printf("%6s. %-40s %10s%\n", "", "$COUNTRY{$key} ($key)", $table->{$key});
+ }
+ $counter++;
+ $previous_value = $table->{$key};
+ }
+}
+
+
+# Statistics
+# ----------
+
+printf("Translated in %d languages\n\n",
+ (scalar keys %table_supported) +
+ (scalar keys %table_partially) +
+ (scalar keys %table_unsupported));
+
+printf("%60s %d\n", "Supported languages (more than 80% strings translated):", (scalar keys %table_supported));
+printf("%60s %d\n", "Partially supported languages (between 50% and 80%):", (scalar keys %table_partially));
+printf("%60s %d\n", "Unsupported languages (less than 50%):", (scalar keys %table_unsupported));
+
+# Detailled report
+# ----------------
+display_report("Supported languages (more than 80% strings translated).", \%table_supported);
+display_report("Partially supported languages (between 50% and 80%).", \%table_partially);
+display_report("Unsupported languages (less than 50%).", \%table_unsupported);