r111934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111933‎ | r111934 | r111935 >
Date:15:09, 20 February 2012
Author:santhosh
Status:ok (Comments)
Tags:i18nreview, todo 
Comment:
Avoid unconditional modification of original word in fi convertGrammar
Do not call convertgrammar unless word and form are defined.
Use a grammarForm that no other language use in jqueryMsg test to avoid conflict when test is executed with that language.

Followup 111725
Modified paths:
  • /branches/jsgrammar/resources/mediawiki.language/languages/fi.js (modified) (history)
  • /branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js (modified) (history)
  • /branches/jsgrammar/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js (modified) (history)

Diff [purge]

Index: branches/jsgrammar/tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js
@@ -46,9 +46,10 @@
4747 expect( 5 );
4848 var parser = mw.jqueryMsg.getMessageFunction();
4949 ok( parser, 'Parser Function initialized' );
50 - ok( mw.messages.set( 'grammar-msg', 'Przeszukaj {{GRAMMAR:genitive|{{SITENAME}}}}' ), 'mw.messages.set: Register' );
 50+ // Hope the grammar form rammar_case_foo is not valid in any language
 51+ ok( mw.messages.set( 'grammar-msg', 'Przeszukaj {{GRAMMAR:grammar_case_foo|{{SITENAME}}}}' ), 'mw.messages.set: Register' );
5152 equal( parser( 'grammar-msg' ) , 'Przeszukaj ' + mw.config.get( 'wgSiteName' ) , 'Grammar Test with sitename' );
52 - ok( mw.messages.set( 'grammar-msg-wrong-syntax', 'Przeszukaj {{GRAMMAR:genitive}}' ), 'mw.messages.set: Register' );
 53+ ok( mw.messages.set( 'grammar-msg-wrong-syntax', 'Przeszukaj {{GRAMMAR:grammar_case_xyz}}' ), 'mw.messages.set: Register' );
5354 equal( parser( 'grammar-msg-wrong-syntax' ) , 'Przeszukaj ' , 'Grammar Test with wrong grammar template syntax' );
5455 } );
5556
Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js
@@ -672,7 +672,7 @@
673673 grammar: function( nodes ) {
674674 var form = nodes[0];
675675 var word = nodes[1];
676 - return this.language.convertGrammar( word, form );
 676+ return word && form && this.language.convertGrammar( word, form );
677677 }
678678 };
679679
Index: branches/jsgrammar/resources/mediawiki.language/languages/fi.js
@@ -11,7 +11,7 @@
1212
1313 // vowel harmony flag
1414 var aou = word.match( /[aou][^äöy]*$/i );
15 -
 15+ var origWord = word;
1616 if ( word.match( /wiki$/i ) ) {
1717 aou = false;
1818 }
@@ -36,6 +36,9 @@
3737 case 'inessive':
3838 word += ( aou ? 'ssa' : 'ssä' );
3939 break;
 40+ default:
 41+ word = origWord;
 42+ break;
4043 }
4144 return word;
4245 };

Sign-offs

UserFlagDate
Nikerabbitinspected07:42, 21 February 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r112007Minor whitespace and typo fixes. ping r111934santhosh12:02, 21 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111725Qunit test cases for the grammar support in mw.jqueryMsg added in r111646santhosh04:50, 17 February 2012

Comments

#Comment by Amire80 (talk | contribs)   05:35, 21 February 2012

Missing 'g' in rammar_case_foo. Two spaces in 'return word && form'. The origWord trick may be needed in LanguageFi.php, too.

Status & tagging log