r91676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91675‎ | r91676 | r91677 >
Date:20:15, 7 July 2011
Author:krinkle
Status:deferred
Tags:
Comment:
better examples for demo8
Modified paths:
  • /trunk/tools/ToolserverI18N/public_html/demo/demo8.php (modified) (history)
  • /trunk/tools/ToolserverI18N/public_html/demo/demoBase.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/public_html/demo/demo8.php
@@ -8,28 +8,31 @@
99 $I18N = new TsIntuition( 'general' /* name of textdomain here */ );
1010
1111 // 2) Register some interesting messages
12 -$I18N->setMsg( 'apple-stats', 'Apple status: $1 {{PLURAL:$1|apple|apples}} in the basket.' );
 12+$I18N->setMsgs( array(
 13+ 'welcomeback' => 'Welcome back, $1! Would you like some $2?',
 14+ 'basket' => 'The basket contains $1 {{PLURAL:$1|apple|apples}}.',
 15+) );
1316
14 -// 2) Use MessagesFunctions
 17+// 2) Use rendering and formatting
1518
1619 // - Raw echo
1720 echo $I18N->msg( 'apple-stats' );
1821
1922 echo '<br />';
2023
21 -// - Pass variables, setting $1 to '1'
22 -echo '<br />' . $I18N->msg( 'apple-stats', array( 'variables' => array( '1' ) ) );
 24+// - Pass variables
 25+echo '<br />' . $I18N->msg( 'welcomeback', array( 'variables' => array( 'John', 'coffee' ) ) );
2326
24 -// - Pass variables, setting $1 to '7'
25 -echo '<br />' . $I18N->msg( 'apple-stats', array( 'variables' => array( '7' ) ) );
 27+// - Pass variables
 28+echo '<br />' . $I18N->msg( 'welcomeback', array( 'variables' => array( 'George', 'tea' ) ) );
2629
2730 echo '<br />';
2831
2932 // - Trigger parser magic, setting $1 to '1'
30 -echo '<br />' . $I18N->msg( 'apple-stats', array( 'variables' => array( '1' ), 'parsemag' => true ) );
 33+echo '<br />' . $I18N->msg( 'basket', array( 'variables' => array( '1' ), 'parsemag' => true ) );
3134
3235 // - Trigger parser magic, setting $1 to '7'
33 -echo '<br />' . $I18N->msg( 'apple-stats', array( 'variables' => array( '7' ), 'parsemag' => true ) );
 36+echo '<br />' . $I18N->msg( 'basket', array( 'variables' => array( '7' ), 'parsemag' => true ) );
3437
3538
3639
Index: trunk/tools/ToolserverI18N/public_html/demo/demoBase.php
@@ -13,7 +13,7 @@
1414 'demo5' => 'Dashboard backlink and footer line',
1515 'demo6' => 'Utility examples',
1616 'demo7' => 'Language names',
17 - 'demo8' => 'Plural examples',
 17+ 'demo8' => 'Rendering examples',
1818 );
1919
2020 $thisFile = basename( $_SERVER['SCRIPT_NAME'], '.php' );

Status & tagging log