r33919 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33918‎ | r33919 | r33920 >
Date:18:09, 26 April 2008
Author:minuteelectron
Status:old
Tags:
Comment:
* Add babel-*-n message series for the translations of the messages with the language name rather than $3.
* Use the message with the language name if possible, if not use the generic one.
Modified paths:
  • /trunk/extensions/Babel/Babel.i18n.php (modified) (history)
  • /trunk/extensions/Babel/Babel.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/Babel.i18n.php
@@ -26,6 +26,14 @@
2727 'babel-5' => 'This user has [[$1|professional]] knowledge of [[$2|$3]].',
2828 'babel-N' => 'This user has a [[$1|native]] understanding of [[$2|$3]].',
2929
 30+ 'babel-0-n' => 'This user has [[$1|no]] knowledge of [[$2|English]] (or understands it with considerable difficulty).',
 31+ 'babel-1-n' => 'This user has [[$1|basic]] knowledge of [[$2|English]].',
 32+ 'babel-2-n' => 'This user has [[$1|intermediate]] knowledge of [[$2|English]].',
 33+ 'babel-3-n' => 'This user has [[$1|advanced]] knowledge of [[$2|English]].',
 34+ 'babel-4-n' => 'This user has [[$1|near native speaker]] knowledge of [[$2|English]].',
 35+ 'babel-5-n' => 'This user has [[$1|professional]] knowledge of [[$2|English]].',
 36+ 'babel-N-n' => 'This user has a [[$1|native]] understanding of [[$2|English]].',
 37+
3038 'babel-box-cellspacing' => '0', # do not translate or duplicate this message to other languages
3139
3240 'babel-category-prefix' => '', # do not translate or duplicate this message to other languages
Index: trunk/extensions/Babel/Babel.php
@@ -280,13 +280,27 @@
281281 /* Generate the text displayed on the right hand side of the
282282 * box.
283283 */
284 - $text = wfMsgExt( "babel-$level",
285 - array( 'language' => $code ),
 284+
 285+ /* Try the language of the box.
 286+ */
 287+ $text = wfMsgExt( "babel-$level-n",
 288+ array( 'nofallback', 'language' => $code ),
286289 ":Category:{$prefixes['category']}$code-$level{$suffixes['category']}",
287 - ":Category:{$prefixes['category']}$code{$suffixes['category']}",
288 - $name
 290+ ":Category:{$prefixes['category']}$code{$suffixes['category']}"
289291 );
290292
 293+ /* Translation not found, use the generic translation of the
 294+ * highest level fallback possible.
 295+ */
 296+ if( $text == htmlspecialchars( "<babel-$level-n>" ) ) {
 297+ $text = wfMsgExt( "babel-$level",
 298+ array( 'language' => $code ),
 299+ ":Category:{$prefixes['category']}$code-$level{$suffixes['category']}",
 300+ ":Category:{$prefixes['category']}$code{$suffixes['category']}",
 301+ $name
 302+ );
 303+ }
 304+
291305 /* Get the directionality for the current language.
292306 */
293307 $dir = wfMsgExt( "babel-directionality",

Status & tagging log