X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FDiffLanguage.php;h=4bd71775a8eb88274cd2ed3253eb33a96abefe67;hb=963901c8dd9eaebd042c3ab20c30fb555f2adbed;hp=89955c53c864d70db7216345ba84d10014fbc5b8;hpb=e464f316fb20d734af2bc1d9cbe3278f98b56587;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/DiffLanguage.php b/maintenance/DiffLanguage.php index 89955c53c8..4bd71775a8 100644 --- a/maintenance/DiffLanguage.php +++ b/maintenance/DiffLanguage.php @@ -2,46 +2,48 @@ # MediaWiki web-based config/installation # Copyright (C) 2004 Ashar Voultoiz and others # http://www.mediawiki.org/ -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program 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., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # http://www.gnu.org/copyleft/gpl.html +/** + * The goal is to get a list of messages not yet localised in a + * languageXX.php file using the language.php file as reference. + * + * Usage: + * php DiffLanguage.php + * + * Enter the language code following "Language" of the LanguageXX.php + * you want to check. If using linux you might need to follow case aka + * Zh and not zh. + * + * The script then print a list of wgAllMessagesXX keys that aren't + * localised, a percentage of messages correctly localised and the + * number of messages to be translated. + * @package MediaWiki + * @subpackage Maintenance + */ -# This script is an alpha version. -# -# The goal is to get a list of messages not yet localised in a -# languageXX.php file using the language.php file as reference. -# -# Usage: -# php DiffLanguage.php -# -# Enter the language code following "Language" of the LanguageXX.php -# you want to check. If using linux you might need to follow case aka -# Zh and not zh. -# -# The script then print a list of wgAllMessagesXX keys that aren't -# localised, a percentage of messages correctly localised and the -# number of messages to be translated. - +/** This script run from the commandline */ require_once( "commandLine.inc" ); $wgLanguageCode = strtoupper(substr($wgLanguageCode,0,1)).strtolower(substr($wgLanguageCode,1)); # read command line argument -if ( isset($argv[1]) ) { - $lang = $argv[1]; +if ( isset($args[0]) ) { + $lang = $args[0]; # or prompt a simple menu } else { @@ -50,25 +52,25 @@ if ( isset($argv[1]) ) { @ob_end_flush(); print "Enter the language you want to check [$wgLanguageCode]:"; $input = readconsole(); - + # set the input to current language if($input == "") { $input = $wgLanguageCode; } - + # convert to 1st char upper, rest lower case $input = strtoupper(substr($input,0,1)).strtolower(substr($input,1)); - - # try to get the file - if( file_exists("../languages/Language$input.php") ) { + + # try to get the file + if( file_exists("$IP/languages/Language$input.php") ) { $loop = false; $lang = $input; } else { print "ERROR: The file Language$input.php doesn't exist !\n"; } - + } while ($loop); - + } /* TODO @@ -79,7 +81,7 @@ if ( isset($argv[1]) ) { # include the language if it's not the already loaded one if($lang != $wgLanguageCode) { print "Including language file for $lang.\n"; - include("Language{$lang}.php"); + include_once("Language{$lang}.php"); } /* ugly hack to load the correct array, if you have a better way @@ -102,4 +104,4 @@ foreach($wgAllMessagesEn as $index => $localized) } echo "----\n"; echo "$lang language is complete at ".number_format((100 - $i/count($wgAllMessagesEn) * 100),2)."%\n"; -echo "$i unlocalised message of the ".count($wgAllMessagesEn)." messages available.\n"; +echo "$i unlocalised messages of the ".count($wgAllMessagesEn)." messages available.\n";