2 # MediaWiki web-based config/installation
3 # Copyright (C) 2004 Ashar Voultoiz <thoane@altern.org> and others
4 # http://www.mediawiki.org/
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # http://www.gnu.org/copyleft/gpl.html
22 # This script is an alpha version.
24 # The goal is to get a list of messages not yet localised in a
25 # languageXX.php file using the language.php file as reference.
28 # php DiffLanguage.php
30 # Enter the language code following "Language" of the LanguageXX.php
31 # you want to check. If using linux you might need to follow case aka
34 # The script then print a list of wgAllMessagesXX keys that aren't
35 # localised, a percentage of messages correctly localised and the
36 # number of messages to be translated.
40 # - File paths are hardcoded
41 # - Can't check your configured language.(says nothing is localised)
45 $wgCommandLineMode = true;
46 # Turn off output buffering if it's on
49 include_once("../LocalSettings.php");
50 include_once( "../includes/Setup.php" );
51 include_once( "../install-utils.inc" );
53 # read command line argument
54 if ( isset($argv[1]) ) {
57 # or prompt a simple menu
60 print "Enter the language you want to check [$wgLanguageCode]:";
63 $input = readconsole();
65 # set the input to current language
67 $input = $wgLanguageCode;
71 if( file_exists("../Languages/Language$input.php") ) {
80 Need to check case of the $lang : 1st char upper 2nd char lower
84 # include the language if it's not the already loaded one
85 if($lang != $wgLanguageCode) {
86 print "Including language file for $lang.\n";
88 include("Language{$lang}.php");
91 /* ugly hack to load the correct array, if you have a better way
92 to achieve the same goal, recode it ! */
93 $foo = "wgAllMessages$lang";
95 /* end of ugly hack */
98 # Get all references messages and check if they exist in the tested language
100 print "Checking $lang localisation file against reference (en):\n----\n";
101 foreach($wgAllMessagesEn as $index => $localized)
103 if(!(isset($testme[$index]))) {
110 echo (100 - $i/count($wgAllMessagesEn) * 100)."% completed\n";
111 echo "$i unlocalised of the ".count($wgAllMessagesEn)." messages available.\n";