#!/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 # 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 = ( 'af' => 'Afrikaans', 'am' => 'Amharic', 'ang' => 'Old English', 'ar' => 'Arabic', 'as' => 'Assamese', 'az' => 'Azerbaijani', 'az_IR' => 'Iranian Azerbaijani', 'be' => 'Belarusian', 'bg' => 'Bulgarian', 'bn' => 'Bengali', 'br' => 'Breton', 'bs' => 'Bosnian', 'ca' => 'Catalan', 'cs' => 'Czech', 'cy' => 'Welsh', 'da' => 'Danish', 'de' => 'German', 'el' => 'Greek', 'en_AU' => 'Australian English', 'en_CA' => 'Canadian English', 'en_GB' => 'British English', 'eo' => 'Esperanto', 'es' => 'Spanish', 'et' => 'Estonian', 'eu' => 'Basque', 'fa' => 'Persian', 'fi' => 'Finnish', 'fr' => 'French', 'ga' => 'Irish Gaelic', 'gl' => 'Galician', 'gu' => 'Gujarati', 'he' => 'Hebrew', 'hi' => 'Hindi', 'hr' => 'Croatian', 'hu' => 'Hungarian', 'ia' => 'Interlingua', 'id' => 'Indonesian', 'is' => 'Icelandic', 'it' => 'Italian', 'ja' => 'Japanese', 'ka' => 'Georgian', 'kn' => 'Kannada', 'ko' => 'Korean', 'li' => 'Limburgish', 'lt' => 'Lithuanian', 'lv' => 'Latvian', 'mi' => 'Maori', 'mk' => 'Macedonian', 'ml' => 'Malayalam', 'mn' => 'Mongolian', 'mr' => 'Marathi', 'ms' => 'Malay', 'nb' => 'Norwegian Bookmal', 'ne' => 'Nepali', 'nl' => 'Dutch', 'nn' => 'Norwegian Nynorsk', 'nso' => 'Northern Sotho', 'or' => 'Oriya', 'pa' => 'Punjabi', 'pl' => 'Polish', 'pt' => 'Portuguese', 'pt_BR' => 'Brazilian Portuguese', 'ro' => 'Romanian', 'ru' => 'Russian', 'rw' => 'Kinyarwanda', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'sq' => 'Albanian', 'sr' => 'Serbian', 'sr@Latn' => 'Serbian', 'sr@ije' => 'Serbian Jekavian', 'sv' => 'Swedish', 'ta' => 'Tamil', 'tg' => 'Tajik', 'th' => 'Thai', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'uk' => 'Ukrainian', 'uz' => 'Uzbek', 'uz@Latn' => 'Uzbek Latin', 'vi' => 'Vietnamese', 'wa' => 'Wallon', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'zh_CN' => 'Chinese Simplified', 'zh_TW' => 'Chinese Traditional', 'zu' => 'Zulu', ); print STDERR "Please WAIT, running 'cd po && ../intltool-update --report'\n"; my $report = `export LC_ALL=C && cd po && ../intltool-update --report 2>&1`; #For test to speed up create a fixed report file with the previous command output #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);