r90764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90763‎ | r90764 | r90765 >
Date:10:35, 25 June 2011
Author:jan
Status:ok (Comments)
Tags:
Comment:
getFallbacks.php: Get fallbacks from MediaWiki Core
Fallbacks.php: Update fallbacks by using getFallbacks.php
Modified paths:
  • /trunk/tools/ToolserverI18N/language/Fallbacks.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/getFallbacks.php (added) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/language/Fallbacks.php
@@ -5,21 +5,164 @@
66
77 // Listed a few examples for now.
88 // Perhaps this can be automated in the future via TranslateWiki based on MediaWiki's core fallbacks.
 9+// Values can be geted by getFallbacks.php
910 $fallbacks = array(
10 - 'ab' => 'ru',
11 - 'ace' => 'id',
12 - 'aln' => 'sq',
13 - 'als' => 'gsw',
14 - 'an' => 'es',
15 - 'arn' => 'es',
16 - 'arz' => 'ar',
17 - 'as' => 'bn',
18 - 'av' => 'ru',
19 - 'ay' => 'es',
20 -
21 - 'fy' => 'nl',
22 -
23 - 'nds' => 'de',
24 -
25 - 'os' => 'ru',
 11+ 'ab' => 'ru',
 12+ 'ace' => 'id',
 13+ 'aln' => 'sq',
 14+ 'als' => 'gsw',
 15+ 'an' => 'es',
 16+ 'anp' => 'hi',
 17+ 'arn' => 'es',
 18+ 'arz' => 'ar',
 19+ 'as' => 'bn',
 20+ 'av' => 'ru',
 21+ 'ay' => 'es',
 22+ 'ba' => 'ru',
 23+ 'bar' => 'de',
 24+ 'bat_smg' => 'sgs',
 25+ 'bcc' => 'fa',
 26+ 'be_x_old' => 'be-tarask',
 27+ 'bh' => 'bho',
 28+ 'bjn' => 'id',
 29+ 'bm' => 'fr',
 30+ 'bpy' => 'bn',
 31+ 'bqi' => 'fa',
 32+ 'ce' => 'ru',
 33+ 'crh' => 'crh-latn',
 34+ 'crh_cyrl' => 'ru',
 35+ 'csb' => 'pl',
 36+ 'cv' => 'ru',
 37+ 'de_at' => 'de',
 38+ 'de_ch' => 'de',
 39+ 'de_formal' => 'de',
 40+ 'dsb' => 'de',
 41+ 'dtp' => 'ml',
 42+ 'eml' => 'it',
 43+ 'ff' => 'fr',
 44+ 'fiu_vro' => 'vro',
 45+ 'frp' => 'fr',
 46+ 'frr' => 'de',
 47+ 'fur' => 'it',
 48+ 'gag' => 'tr',
 49+ 'gan' => 'gan-hant',
 50+ 'gan_hans' => 'zh-hans',
 51+ 'gan_hant' => 'zh-hant',
 52+ 'gl' => 'pt',
 53+ 'glk' => 'fa',
 54+ 'gn' => 'es',
 55+ 'gsw' => 'de',
 56+ 'hif' => 'hif-latn',
 57+ 'hsb' => 'de',
 58+ 'ht' => 'fr',
 59+ 'ii' => 'zh-cn',
 60+ 'inh' => 'ru',
 61+ 'iu' => 'ike-cans',
 62+ 'jut' => 'da',
 63+ 'jv' => 'id',
 64+ 'kaa' => 'kk-latn',
 65+ 'kbd' => 'kbd-cyrl',
 66+ 'kbd_cyrl' => 'ru',
 67+ 'khw' => 'ur',
 68+ 'kiu' => 'tr',
 69+ 'kk' => 'kk-cyrl',
 70+ 'kk_arab' => 'kk-cyrl',
 71+ 'kk_cn' => 'kk-arab',
 72+ 'kk_kz' => 'kk-cyrl',
 73+ 'kk_latn' => 'kk-cyrl',
 74+ 'kk_tr' => 'kk-latn',
 75+ 'kl' => 'da',
 76+ 'ko_kp' => 'ko',
 77+ 'koi' => 'ru',
 78+ 'krc' => 'ru',
 79+ 'ksh' => 'de',
 80+ 'ku' => 'ku-latn',
 81+ 'ku_arab' => 'ckb',
 82+ 'kv' => 'ru',
 83+ 'lad' => 'es',
 84+ 'lb' => 'de',
 85+ 'lbe' => 'ru',
 86+ 'li' => 'nl',
 87+ 'lij' => 'it',
 88+ 'liv' => 'et',
 89+ 'lmo' => 'it',
 90+ 'ln' => 'fr',
 91+ 'ltg' => 'lv',
 92+ 'lzz' => 'tr',
 93+ 'mai' => 'hi',
 94+ 'map_bms' => 'jv',
 95+ 'mg' => 'fr',
 96+ 'mhr' => 'ru',
 97+ 'min' => 'id',
 98+ 'mo' => 'ro',
 99+ 'mrj' => 'ru',
 100+ 'mwl' => 'pt',
 101+ 'myv' => 'ru',
 102+ 'mzn' => 'fa',
 103+ 'nah' => 'es',
 104+ 'nap' => 'it',
 105+ 'nb' => 'no',
 106+ 'nds' => 'de',
 107+ 'nds_nl' => 'nl',
 108+ 'nl_informal' => 'nl',
 109+ 'os' => 'ru',
 110+ 'pcd' => 'fr',
 111+ 'pdc' => 'de',
 112+ 'pdt' => 'de',
 113+ 'pfl' => 'de',
 114+ 'pms' => 'it',
 115+ 'pt_br' => 'pt',
 116+ 'qu' => 'es',
 117+ 'rgn' => 'it',
 118+ 'rmy' => 'ro',
 119+ 'roa_rup' => 'rup',
 120+ 'rue' => 'uk',
 121+ 'ruq' => 'ruq-latn',
 122+ 'ruq_cyrl' => 'mk',
 123+ 'ruq_latn' => 'ro',
 124+ 'sa' => 'hi',
 125+ 'sah' => 'ru',
 126+ 'scn' => 'it',
 127+ 'sg' => 'fr',
 128+ 'sgs' => 'lt',
 129+ 'simple' => 'en',
 130+ 'sli' => 'de',
 131+ 'sr' => 'sr-ec',
 132+ 'srn' => 'nl',
 133+ 'stq' => 'de',
 134+ 'su' => 'id',
 135+ 'szl' => 'pl',
 136+ 'tcy' => 'kn',
 137+ 'tg' => 'tg-cyrl',
 138+ 'tt' => 'tt-cyrl',
 139+ 'tt_cyrl' => 'ru',
 140+ 'ty' => 'fr',
 141+ 'udm' => 'ru',
 142+ 'ug' => 'ug-arab',
 143+ 'uk' => 'ru',
 144+ 'vec' => 'it',
 145+ 'vep' => 'et',
 146+ 'vls' => 'nl',
 147+ 'vmf' => 'de',
 148+ 'vot' => 'fi',
 149+ 'vro' => 'et',
 150+ 'wa' => 'fr',
 151+ 'wo' => 'fr',
 152+ 'wuu' => 'zh-hans',
 153+ 'xal' => 'ru',
 154+ 'xmf' => 'ka',
 155+ 'yi' => 'he',
 156+ 'za' => 'zh-hans',
 157+ 'zea' => 'nl',
 158+ 'zh' => 'zh-hans',
 159+ 'zh_classical' => 'lzh',
 160+ 'zh_cn' => 'zh-hans',
 161+ 'zh_hant' => 'zh-hans',
 162+ 'zh_hk' => 'zh-hant',
 163+ 'zh_min_nan' => 'nan',
 164+ 'zh_mo' => 'zh-hk',
 165+ 'zh_my' => 'zh-sg',
 166+ 'zh_sg' => 'zh-hans',
 167+ 'zh_tw' => 'zh-hant',
 168+ 'zh_yue' => 'yue'
26169 );
Index: trunk/tools/ToolserverI18N/language/getFallbacks.php
@@ -0,0 +1,33 @@
 2+<?PHP
 3+/**
 4+ *
 5+ * Get fallbacks from MediaWiki Core.
 6+ * @author Jan Luca <jan@toolserver.org>
 7+ */
 8+
 9+$dir = "<path to messages dir of MediaWiki>";
 10+$files = scandir( $dir );
 11+
 12+$output = fopen("output.php", "w");
 13+
 14+$reg = "@fallback \\= \\'(.*?)\\'\\;@i";
 15+
 16+foreach( $files as $file ) {
 17+ if( $file == "." || $file == ".." || $file == ".svn" ) {
 18+ continue;
 19+ }
 20+
 21+ $file = $dir."/".$file;
 22+
 23+ $content = file_get_contents( $file );
 24+
 25+ if( !$content ) die("Error: " . $file);
 26+
 27+ if( preg_match( $reg, $content, $match ) ) {
 28+ $fallback_lang = $match[1];
 29+ preg_match("@Messages(.*?)\\.php@", $file, $file_match);
 30+ $source_lang = $file_match[1];
 31+ $source_lang = strtolower($source_lang);
 32+ fwrite($output, "'".$source_lang."' => '".$fallback_lang."',\n");
 33+ }
 34+}
\ No newline at end of file
Property changes on: trunk/tools/ToolserverI18N/language/getFallbacks.php
___________________________________________________________________
Added: svn:eol-style
135 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r91589Minor fixes and follow-up to r91439 (Integration of PLURAL / MediaWiki langua...krinkle19:39, 6 July 2011
r113314[TsIntution] Fix typo in file name...krinkle22:55, 7 March 2012

Comments

#Comment by Krinkle (talk | contribs)   01:12, 26 June 2011

Nice work.

Status & tagging log