r111912 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111911‎ | r111912 | r111913 >
Date:06:10, 20 February 2012
Author:santhosh
Status:resolved (Comments)
Tags:i18nreview 
Comment:
Ukrainian grammar rules ported to js with qunit testcases
Removed some trailing commas from mediawiki.language.test.js
Modified paths:
  • /branches/jsgrammar/resources/mediawiki.language/languages/uk.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
@@ -97,7 +97,7 @@
9898 test: [
9999 { word: 'Wikipédiá', grammarForm: 'rol', expected: 'Wikipédiáról', description: 'Grammar test for Hungarian, rol case' },
100100 { word: 'Wikipédiá', grammarForm: 'ba', expected: 'Wikipédiába', description: 'Grammar test for Hungarian, ba case' },
101 - { word: 'Wikipédiá', grammarForm: 'k', expected: 'Wikipédiák', description: 'Grammar test for Hungarian, k case' },
 101+ { word: 'Wikipédiá', grammarForm: 'k', expected: 'Wikipédiák', description: 'Grammar test for Hungarian, k case' }
102102 ]
103103 });
104104
@@ -106,6 +106,19 @@
107107 test: [
108108 { word: 'an Domhnach', grammarForm: 'ainmlae', expected: 'Dé Domhnaigh', description: 'Grammar test for Irish, ainmlae case' },
109109 { word: 'an Luan', grammarForm: 'ainmlae', expected: 'Dé Luain', description: 'Grammar test for Irish, ainmlae case' },
110 - { word: 'an Satharn', grammarForm: 'ainmlae', expected: 'Dé Sathairn', description: 'Grammar test for Irish, ainmlae case' },
 110+ { word: 'an Satharn', grammarForm: 'ainmlae', expected: 'Dé Sathairn', description: 'Grammar test for Irish, ainmlae case' }
111111 ]
112112 });
 113+
 114+mw.language.grammartest({
 115+ language: 'uk',
 116+ test: [
 117+ { word: 'тесть', grammarForm: 'genitive', expected: 'тестя', description: 'Grammar test for Ukrainian, genitive case' },
 118+ { word: 'Вікіпедія', grammarForm: 'genitive', expected: 'Вікіпедії', description: 'Grammar test for Ukrainian, genitive case' },
 119+ { word: 'установка', grammarForm: 'genitive', expected: 'установки', description: 'Grammar test for Ukrainian, genitive case' },
 120+ { word: 'похоти', grammarForm: 'genitive', expected: 'похотей', description: 'Grammar test for Ukrainian, genitive case' },
 121+ { word: 'доводы', grammarForm: 'genitive', expected: 'доводов', description: 'Grammar test for Ukrainian, genitive case' },
 122+ { word: 'песчаник', grammarForm: 'genitive', expected: 'песчаника', description: 'Grammar test for Ukrainian, genitive case' },
 123+ { word: 'Вікіпедія', grammarForm: 'accusative', expected: 'Вікіпедію', description: 'Grammar test for Ukrainian, accusative case' }
 124+ ]
 125+});
Index: branches/jsgrammar/resources/mediawiki.language/languages/uk.js
@@ -1,5 +1,5 @@
22 /**
3 - * Ukrainian (Українська) language functions
 3+ * Ukrainian (УкраїМська) language functions
44 */
55
66 mediaWiki.language.convertPlural = function( count, forms ) {
@@ -21,3 +21,35 @@
2222 return forms[2];
2323 }
2424 };
 25+
 26+mediaWiki.language.convertGrammar = function( word, form ) {
 27+ var grammarForms = mw.language.data[ 'uk' ].get( 'grammarForms' );
 28+ if ( grammarForms && grammarForms[form] ) {
 29+ return grammarForms[form][word] ;
 30+ }
 31+ switch ( form ) {
 32+ case 'genitive': // родовий відмінок
 33+ if ( ( word.substr( word.length - 4 ) == 'вікі' ) || ( word.substr( word.length - 4 ) == 'Вікі' ) ) {
 34+ }
 35+ else if ( word.substr( word.length - 1 ) == 'ь' )
 36+ word = word.substr(0, word.length - 1 ) + 'я';
 37+ else if ( word.substr( word.length - 2 ) == 'ія' )
 38+ word = word.substr(0, word.length - 2 ) + 'ії';
 39+ else if ( word.substr( word.length - 2 ) == 'ка' )
 40+ word = word.substr(0, word.length - 2 ) + 'ки';
 41+ else if ( word.substr( word.length - 2 ) == 'ти' )
 42+ word = word.substr(0, word.length - 2 ) + 'тей';
 43+ else if ( word.substr( word.length - 2 ) == 'ды' )
 44+ word = word.substr(0, word.length - 2 ) + 'дов';
 45+ else if ( word.substr( word.length - 3 ) == 'ник' )
 46+ word = word.substr(0, word.length - 3 ) + 'ника';
 47+ break;
 48+ case 'accusative': // знахідний відмінок
 49+ if ( ( word.substr( word.length - 4 ) == 'вікі' ) || ( word.substr( word.length - 4 ) == 'Вікі' ) ) {
 50+ }
 51+ else if ( word.substr( word.length - 2 ) == 'ія' )
 52+ word = word.substr(0, word.length - 2 ) + 'ію';
 53+ break;
 54+ }
 55+ return word;
 56+};

Follow-up revisions

RevisionCommit summaryAuthorDate
r111919Port grammar rules to js for os, sl with qunit tests...santhosh10:10, 20 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111910Port grammar rules of dsb, hu, ga to javascript with qunit tests...santhosh05:38, 20 February 2012

Comments

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

Broken encoding in branches/jsgrammar/resources/mediawiki.language/languages/uk.js.

Some inconsistent spacing around parenthesis and semicolons.

Status & tagging log