Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

checktrans-enhanced.php

Go to the documentation of this file.
00001 <?php 00002 00003 # Check to see if all messages have been translated into 00004 # the selected language. To run this script, you must have 00005 # a working installation, and it checks the selected language 00006 # of that installation. 00007 # 00008 # The enhanced version will check more arrays than just 00009 # wgAllMessages 00010 00011 00012 00013 function check($arrayname) 00014 { 00015 $arraynameprinted = 0; 00016 00017 global $count, $total, $wgLanguageCode; 00018 00019 $msgarray = $arrayname . ucfirst( $wgLanguageCode ); 00020 $msgarrayen = $arrayname . "En"; 00021 00022 global $$msgarray; 00023 global $$msgarrayen; 00024 00025 foreach ( $$msgarrayen as $code => $msg ) { 00026 ++$total; 00027 00028 if ( ! array_key_exists( $code, $$msgarray ) ) { 00029 if (!$arraynameprinted) { 00030 print("\nIn array '$msgarray':\n"); 00031 $arraynameprinted = 1; 00032 } 00033 00034 print "{$code}\n"; 00035 ++$count; 00036 } 00037 } 00038 } 00039 00040 00041 00042 00043 00044 00045 if ( ! is_readable( "../LocalSettings.php" ) ) { 00046 print "A copy of your installation's LocalSettings.php\n" . 00047 "must exist in the source directory.\n"; 00048 exit(); 00049 } 00050 00051 $DP = "../includes"; 00052 require_once( "../LocalSettings.php" ); 00053 00054 if ( "en" == $wgLanguageCode ) { 00055 print "Current selected language is English. Cannot check translations.\n"; 00056 exit(); 00057 } 00058 $include = "Language" . ucfirst( $wgLanguageCode ) . ".php"; 00059 if ( ! is_readable( "{$IP}/{$include}" ) ) { 00060 print "Translation file \"{$include}\" not found in installation directory.\n" . 00061 "You must have the software installed to run this script.\n"; 00062 exit(); 00063 } 00064 00065 umask( 000 ); 00066 set_time_limit( 0 ); 00067 00068 require_once( "{$IP}/Setup.php" ); 00069 $wgTitle = Title::newFromText( "Translation checking script" ); 00070 $wgCommandLineMode = true; 00071 00072 $count = $total = 0; 00073 00074 00075 00076 00077 00078 00079 00080 check("wgLanguageNames"); 00081 check("wgNamespaceNames"); 00082 check("wgDefaultUserOptions"); 00083 check("wgQuickbarSettings"); 00084 check("wgSkinNames"); 00085 check("wgMathNames"); 00086 check("wgUserToggles"); 00087 check("wgWeekdayNames"); 00088 check("wgMonthNames"); 00089 check("wgMonthAbbreviations"); 00090 check("wgValidSpecialPages"); 00091 check("wgSysopSpecialPages"); 00092 check("wgDeveloperSpecialPages"); 00093 check("wgAllMessages"); 00094 00095 print "{$count} messages of {$total} not translated.\n"; 00096

Generated on Tue Jun 29 23:40:03 2004 for Mediawiki by doxygen 1.3.7