Index: branches/jsgrammar/tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js |
— | — | @@ -54,8 +54,16 @@ |
55 | 55 | language: 'he', |
56 | 56 | test: [ |
57 | 57 | { 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.' }, |
59 | 59 | { word: "הקובץ", grammarForm: 'prefixed', expected: "קובץ", description: 'Grammar test for Hebrew, Remove the "He" if prefixed' }, |
60 | 60 | { word: 'wikipedia', grammarForm: 'תחילית', expected: '־wikipedia', description: 'Grammar test for Hebrew, Add a hyphen (maqaf) if non-Hebrew letters' } |
61 | 61 | ] |
62 | 62 | }); |
| 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 @@ |
17 | 17 | return forms[3]; |
18 | 18 | } |
19 | 19 | }; |
| 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 | +}; |