added Russian, Turkish, French and Portuguese (Brazilian) languages
This commit is contained in:
@@ -9,6 +9,9 @@ import de from '@/lang/de'
|
||||
import fr from '@/lang/fr'
|
||||
import id from '@/lang/id'
|
||||
import pt from '@/lang/pt-pt'
|
||||
import ptBr from '@/lang/pt-br'
|
||||
import ru from '@/lang/ru'
|
||||
import tr from '@/lang/tr'
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
@@ -23,7 +26,10 @@ const locales = {
|
||||
de,
|
||||
fr,
|
||||
id,
|
||||
pt
|
||||
pt,
|
||||
ptBr,
|
||||
ru,
|
||||
tr
|
||||
}
|
||||
|
||||
const i18n = new VueI18n({
|
||||
@@ -31,21 +37,33 @@ const i18n = new VueI18n({
|
||||
fallbackLocale: DEFAULT_LANG,
|
||||
messages: locales,
|
||||
pluralizationRules: {
|
||||
/**
|
||||
* @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)`
|
||||
* @param choicesLength {number} an overall amount of available choices
|
||||
* @returns a final choice index to select plural word by
|
||||
*/
|
||||
'ru': function(choice, choicesLength) {
|
||||
if (choice === 0) { return 0 }
|
||||
/**
|
||||
* @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)`
|
||||
* @param choicesLength {number} an overall amount of available choices
|
||||
* @returns a final choice index to select plural word by
|
||||
*/
|
||||
ru: function(choice, choicesLength) {
|
||||
if (choice === 0) {
|
||||
return 0
|
||||
}
|
||||
var n = Math.abs(choice) % 100
|
||||
var n1 = n % 10
|
||||
if (n > 10 && n < 20) { return 3 }
|
||||
if (n1 > 1 && n1 < 5) { return 2 }
|
||||
if (n1 == 1) { return 1 }
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (n > 10 && n < 20) {
|
||||
return 3
|
||||
}
|
||||
|
||||
if (n1 > 1 && n1 < 5) {
|
||||
return 2
|
||||
}
|
||||
|
||||
if (n1 == 1) {
|
||||
return 1
|
||||
}
|
||||
|
||||
return 3
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default i18n
|
||||
|
||||
Reference in New Issue
Block a user