New languages - Portuguese (Std/Brazil) & Norwegian (Bokmål) (#1236)

* Update jquery.i18n to 1.07, add extended plurals support

* Add additional languages - Portuguese, Portuguese (Brazil), Norwegian (Bokmål)
This commit is contained in:
LordGrey
2021-05-01 18:05:45 +02:00
committed by GitHub
parent 17d4406deb
commit cf084265fc
28 changed files with 2650 additions and 229 deletions

View File

@@ -0,0 +1,22 @@
/**
* Bosnian (bosanski) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.bs = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 's ' + word;
break;
case 'lokativ': // locative
word = 'o ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,22 @@
/**
* Lower Sorbian (Dolnoserbski) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.dsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 'z ' + word;
break;
case 'lokatiw': // lokatiw
word = 'wo ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,49 @@
/**
* Finnish (Suomi) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.fi = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
// vowel harmony flag
var aou = word.match( /[aou][^äöy]*$/i ),
origWord = word;
if ( word.match( /wiki$/i ) ) {
aou = false;
}
// append i after final consonant
if ( word.match( /[bcdfghjklmnpqrstvwxz]$/i ) ) {
word += 'i';
}
switch ( form ) {
case 'genitive':
word += 'n';
break;
case 'elative':
word += ( aou ? 'sta' : 'stä' );
break;
case 'partitive':
word += ( aou ? 'a' : 'ä' );
break;
case 'illative':
// Double the last letter and add 'n'
word += word.slice( -1 ) + 'n';
break;
case 'inessive':
word += ( aou ? 'ssa' : 'ssä' );
break;
default:
word = origWord;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,38 @@
/**
* Irish (Gaeilge) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ga = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'ainmlae' ) {
switch ( word ) {
case 'an Domhnach':
word = 'Dé Domhnaigh';
break;
case 'an Luan':
word = 'Dé Luain';
break;
case 'an Mháirt':
word = 'Dé Mháirt';
break;
case 'an Chéadaoin':
word = 'Dé Chéadaoin';
break;
case 'an Déardaoin':
word = 'Déardaoin';
break;
case 'an Aoine':
word = 'Dé hAoine';
break;
case 'an Satharn':
word = 'Dé Sathairn';
break;
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,31 @@
/**
* Hebrew (עברית) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.he = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'prefixed':
case 'תחילית': // the same word in Hebrew
// Duplicate prefixed "Waw", but only if it's not already double
if ( word.slice( 0, 1 ) === 'ו' && word.slice( 0, 2 ) !== 'וו' ) {
word = 'ו' + word;
}
// Remove the "He" if prefixed
if ( word.slice( 0, 1 ) === 'ה' ) {
word = word.slice( 1 );
}
// Add a hyphen (maqaf) before numbers and non-Hebrew letters
if ( word.slice( 0, 1 ) < 'א' || word.slice( 0, 1 ) > 'ת' ) {
word = '־' + word;
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,21 @@
/**
* Upper Sorbian (Hornjoserbsce) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 'z ' + word;
break;
case 'lokatiw': // lokatiw
word = 'wo ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,26 @@
/**
* Hungarian language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hu = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'rol':
word += 'ról';
break;
case 'ba':
word += 'ba';
break;
case 'k':
word += 'k';
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,25 @@
/**
* Armenian (Հայերեն) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hy = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // սեռական հոլով
if ( word.slice( -1 ) === 'ա' ) {
word = word.slice( 0, -1 ) + 'այի';
} else if ( word.slice( -1 ) === 'ո' ) {
word = word.slice( 0, -1 ) + 'ոյի';
} else if ( word.slice( -4 ) === 'գիրք' ) {
word = word.slice( 0, -4 ) + 'գրքի';
} else {
word = word + 'ի';
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,54 @@
/**
* Latin (lingua Latina) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.la = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'i' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'ommunium' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'ae' ); // 1st declension singular
word = word.replace( /libri$/i, 'librorum' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntiorum' ); // 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tionis' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'ntis' );
word = word.replace( /as$/i, 'atis' );
word = word.replace( /es$/i, 'ei' ); // 5th declension singular
break;
case 'accusative':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'um' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'am' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'ommunia' ); // 1st declension singular
word = word.replace( /libri$/i, 'libros' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntios' );// 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tionem' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'ntem' );
word = word.replace( /as$/i, 'atem' );
word = word.replace( /es$/i, 'em' ); // 5th declension singular
break;
case 'ablative':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'o' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'ommunibus' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'a' ); // 1st declension singular
word = word.replace( /libri$/i, 'libris' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntiis' ); // 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tione' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'nte' );
word = word.replace( /as$/i, 'ate' );
word = word.replace( /es$/i, 'e' ); // 5th declension singular
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,98 @@
/**
* Malayalam language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ml = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
form = form.toLowerCase();
switch ( form ) {
case 'ഉദ്ദേശിക':
case 'dative':
if ( word.slice( -1 ) === 'ു' ||
word.slice( -1 ) === 'ൂ' ||
word.slice( -1 ) === 'ൗ' ||
word.slice( -1 ) === 'ൌ'
) {
word += 'വിന്';
} else if ( word.slice( -1 ) === '' ) {
word = word.slice( 0, -1 ) + 'ത്തിന്';
} else if ( word.slice( -1 ) === 'ൻ' ) {
// Atomic chillu n. അവൻ -> അവന്
word = word.slice( 0, -1 ) + 'ന്';
} else if ( word.slice( -3 ) === 'ന്\u200d' ) {
// chillu n. അവൻ -> അവന്
word = word.slice( 0, -1 );
} else if ( word.slice( -1 ) === 'ൾ' || word.slice( -3 ) === 'ള്\u200d' ) {
word += 'ക്ക്';
} else if ( word.slice( -1 ) === 'ർ' || word.slice( -3 ) === 'ര്\u200d' ) {
word += 'ക്ക്';
} else if ( word.slice( -1 ) === 'ൽ' ) {
// Atomic chillu ൽ , ഫയൽ -> ഫയലിന്
word = word.slice( 0, -1 ) + 'ലിന്';
} else if ( word.slice( -3 ) === 'ല്\u200d' ) {
// chillu ല്\u200d , ഫയല്\u200d -> ഫയലിന്
word = word.slice( 0, -2 ) + 'ിന്';
} else if ( word.slice( -2 ) === 'ു്' ) {
word = word.slice( 0, -2 ) + 'ിന്';
} else if ( word.slice( -1 ) === '്' ) {
word = word.slice( 0, -1 ) + 'ിന്';
} else {
// കാവ്യ -> കാവ്യയ്ക്ക്, ഹരി -> ഹരിയ്ക്ക്, മല -> മലയ്ക്ക്
word += 'യ്ക്ക്';
}
break;
case 'സംബന്ധിക':
case 'genitive':
if ( word.slice( -1 ) === '' ) {
word = word.slice( 0, -1 ) + 'ത്തിന്റെ';
} else if ( word.slice( -2 ) === 'ു്' ) {
word = word.slice( 0, -2 ) + 'ിന്റെ';
} else if ( word.slice( -1 ) === '്' ) {
word = word.slice( 0, -1 ) + 'ിന്റെ';
} else if ( word.slice( -1 ) === 'ു' ||
word.slice( -1 ) === 'ൂ' ||
word.slice( -1 ) === 'ൗ' ||
word.slice( -1 ) === 'ൌ'
) {
word += 'വിന്റെ';
} else if ( word.slice( -1 ) === 'ൻ' ) {
// Atomic chillu n. അവൻ -> അവന്റെ
word = word.slice( 0, -1 ) + 'ന്റെ';
} else if ( word.slice( -3 ) === 'ന്\u200d' ) {
// chillu n. അവൻ -> അവന്റെ
word = word.slice( 0, -1 ) + 'റെ';
} else if ( word.slice( -3 ) === 'ള്\u200d' ) {
// chillu n. അവൾ -> അവളുടെ
word = word.slice( 0, -2 ) + 'ുടെ';
} else if ( word.slice( -1 ) === 'ൾ' ) {
// Atomic chillu n. അവള്\u200d -> അവളുടെ
word = word.slice( 0, -1 ) + 'ളുടെ';
} else if ( word.slice( -1 ) === 'ൽ' ) {
// Atomic l. മുയല്\u200d -> മുയലിന്റെ
word = word.slice( 0, -1 ) + 'ലിന്റെ';
} else if ( word.slice( -3 ) === 'ല്\u200d' ) {
// chillu l. മുയല്\u200d -> അവളുടെ
word = word.slice( 0, -2 ) + 'ിന്റെ';
} else if ( word.slice( -3 ) === 'ര്\u200d' ) {
// chillu r. അവര്\u200d -> അവരുടെ
word = word.slice( 0, -2 ) + 'ുടെ';
} else if ( word.slice( -1 ) === 'ർ' ) {
// Atomic chillu r. അവർ -> അവരുടെ
word = word.slice( 0, -1 ) + 'രുടെ';
} else {
word += 'യുടെ';
}
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,75 @@
/**
* Ossetian (Ирон) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.os = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
var endAllative, jot, hyphen, ending;
// Ending for allative case
endAllative = 'мæ';
// Variable for 'j' beetwen vowels
jot = '';
// Variable for "-" for not Ossetic words
hyphen = '';
// Variable for ending
ending = '';
if ( word.match( /тæ$/i ) ) {
// Checking if the $word is in plural form
word = word.slice( 0, -1 );
endAllative = 'æм';
} else if ( word.match( /[аæеёиоыэюя]$/i ) ) {
// Works if word is in singular form.
// Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю,
// я.
jot = 'й';
} else if ( word.match( /у$/i ) ) {
// Checking if word ends on 'у'. 'У' can be either consonant 'W' or
// vowel 'U' in cyrillic Ossetic.
// Examples: {{grammar:genitive|аунеу}} = аунеуы,
// {{grammar:genitive|лæппу}} = лæппуйы.
if ( !word.slice( -2, -1 ).match( /[аæеёиоыэюя]$/i ) ) {
jot = 'й';
}
} else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
hyphen = '-';
}
switch ( form ) {
case 'genitive':
ending = hyphen + jot + 'ы';
break;
case 'dative':
ending = hyphen + jot + 'æн';
break;
case 'allative':
ending = hyphen + endAllative;
break;
case 'ablative':
if ( jot === 'й' ) {
ending = hyphen + jot + 'æ';
} else {
ending = hyphen + jot + 'æй';
}
break;
case 'superessive':
ending = hyphen + jot + 'ыл';
break;
case 'equative':
ending = hyphen + jot + 'ау';
break;
case 'comitative':
ending = hyphen + 'имæ';
break;
}
return word + ending;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,29 @@
/**
* Russian (Русский) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ru = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // родительный падеж
if ( word.slice( -1 ) === 'ь' ) {
word = word.slice( 0, -1 ) + 'я';
} else if ( word.slice( -2 ) === 'ия' ) {
word = word.slice( 0, -2 ) + 'ии';
} else if ( word.slice( -2 ) === 'ка' ) {
word = word.slice( 0, -2 ) + 'ки';
} else if ( word.slice( -2 ) === 'ти' ) {
word = word.slice( 0, -2 ) + 'тей';
} else if ( word.slice( -2 ) === 'ды' ) {
word = word.slice( 0, -2 ) + 'дов';
} else if ( word.slice( -3 ) === 'ник' ) {
word = word.slice( 0, -3 ) + 'ника';
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,26 @@
/**
* Slovenian (Slovenščina) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.sl = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
// locative
case 'mestnik':
word = 'o ' + word;
break;
// instrumental
case 'orodnik':
word = 'z ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -0,0 +1,39 @@
/**
* Ukrainian (Українська) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.uk = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive': // родовий відмінок
if ( word.slice( -1 ) === 'ь' ) {
word = word.slice( 0, -1 ) + 'я';
} else if ( word.slice( -2 ) === 'ія' ) {
word = word.slice( 0, -2 ) + 'ії';
} else if ( word.slice( -2 ) === 'ка' ) {
word = word.slice( 0, -2 ) + 'ки';
} else if ( word.slice( -2 ) === 'ти' ) {
word = word.slice( 0, -2 ) + 'тей';
} else if ( word.slice( -2 ) === 'ды' ) {
word = word.slice( 0, -2 ) + 'дов';
} else if ( word.slice( -3 ) === 'ник' ) {
word = word.slice( 0, -3 ) + 'ника';
}
break;
case 'accusative': // знахідний відмінок
if ( word.slice( -2 ) === 'ія' ) {
word = word.slice( 0, -2 ) + 'ію';
}
break;
}
return word;
}
} );
}( jQuery ) );