r111728 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111727‎ | r111728 | r111729 >
Date:07:12, 17 February 2012
Author:santhosh
Status:resolved (Comments)
Tags:i18nreview 
Comment:
Port convertGrammar method from php to js for hsb and add qunit tests
Modified paths:
  • /branches/jsgrammar/resources/mediawiki.language/languages/hsb.js (modified) (history)
  • /branches/jsgrammar/tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js (modified) (history)

Diff [purge]

Index: branches/jsgrammar/tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js
@@ -54,8 +54,16 @@
5555 language: 'he',
5656 test: [
5757 { word: "ויקיפדיה", grammarForm: 'prefixed', expected: "וויקיפדיה", description: 'Grammar test for Hebrew, Duplicate the "Waw" if prefixed' },
58 - { word: "וויקיפדיה", grammarForm: 'prefixed', expected: "וויקיפדיה", description: 'Grammar test for Hebrew, Duplicate the "Waw" if prefixed, but not if it is already duplicated.' },
 58+ { word: "וולפגנג", grammarForm: 'prefixed', expected: "וולפגנג", description: 'Grammar test for Hebrew, Duplicate the "Waw" if prefixed, but not if it is already duplicated.' },
5959 { word: "הקובץ", grammarForm: 'prefixed', expected: "קובץ", description: 'Grammar test for Hebrew, Remove the "He" if prefixed' },
6060 { word: 'wikipedia', grammarForm: 'תחילית', expected: '־wikipedia', description: 'Grammar test for Hebrew, Add a hyphen (maqaf) if non-Hebrew letters' }
6161 ]
6262 });
 63+
 64+mw.language.grammartest({
 65+ language: 'hsb',
 66+ test: [
 67+ { word: 'word', grammarForm: 'instrumental', expected: 'z word', description: 'Grammar test for Upper Sorbian, instrumental case' },
 68+ { word: 'word', grammarForm: 'lokatiw', expected: 'wo word', description: 'Grammar test for Upper Sorbian, lokatiw case' }
 69+ ]
 70+});
Index: branches/jsgrammar/resources/mediawiki.language/languages/hsb.js
@@ -16,3 +16,20 @@
1717 return forms[3];
1818 }
1919 };
 20+
 21+
 22+mediaWiki.language.convertGrammar = function( word, form ) {
 23+ var grammarForms = mw.language.data[ mw.config.get( 'wgContentLanguage' )].get( 'grammarForms' );
 24+ if ( grammarForms && grammarForms[form] ) {
 25+ return grammarForms[form][word] ;
 26+ }
 27+ switch ( form ) {
 28+ case 'instrumental': // instrumental
 29+ word = 'z ' + word;
 30+ break;
 31+ case 'lokatiw': // lokatiw
 32+ $word = 'wo ' + word;
 33+ break;
 34+ }
 35+ return word;
 36+};

Sign-offs

UserFlagDate
Amire80inspected22:23, 19 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   14:14, 20 February 2012

$word fixed in r111734

Status & tagging log