2020-07-16 22:11:28 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
import VueI18n from 'vue-i18n'
|
|
|
|
|
|
|
|
// Languages
|
|
|
|
import it from '@/lang/it'
|
|
|
|
import en from '@/lang/en'
|
2020-07-29 12:53:10 +00:00
|
|
|
import es from '@/lang/es'
|
2020-07-29 14:29:25 +00:00
|
|
|
import de from '@/lang/de'
|
2020-07-29 14:54:41 +00:00
|
|
|
import fr from '@/lang/fr'
|
2020-07-29 15:17:41 +00:00
|
|
|
import id from '@/lang/id'
|
2020-07-29 15:42:28 +00:00
|
|
|
import pt from '@/lang/pt-pt'
|
2020-08-03 12:01:44 +00:00
|
|
|
import pt_br from '@/lang/pt-br'
|
2020-07-29 16:41:08 +00:00
|
|
|
import ru from '@/lang/ru'
|
|
|
|
import tr from '@/lang/tr'
|
2020-08-03 11:47:32 +00:00
|
|
|
import vn from '@/lang/vn'
|
|
|
|
import hr from '@/lang/hr'
|
2020-08-13 16:57:26 +00:00
|
|
|
import ar from '@/lang/ar'
|
2020-07-16 22:11:28 +00:00
|
|
|
|
|
|
|
Vue.use(VueI18n)
|
|
|
|
|
|
|
|
const DEFAULT_LANG = 'en'
|
|
|
|
|
|
|
|
document.querySelector('html').setAttribute('lang', DEFAULT_LANG)
|
|
|
|
|
|
|
|
const locales = {
|
|
|
|
it,
|
2020-07-29 12:53:10 +00:00
|
|
|
en,
|
2020-07-29 14:29:25 +00:00
|
|
|
es,
|
2020-07-29 14:54:41 +00:00
|
|
|
de,
|
2020-07-29 15:17:41 +00:00
|
|
|
fr,
|
2020-07-29 15:42:28 +00:00
|
|
|
id,
|
2020-07-29 16:41:08 +00:00
|
|
|
pt,
|
2020-08-03 12:01:44 +00:00
|
|
|
pt_br,
|
2020-07-29 16:41:08 +00:00
|
|
|
ru,
|
2020-08-03 11:47:32 +00:00
|
|
|
tr,
|
|
|
|
vn,
|
2020-08-13 16:57:26 +00:00
|
|
|
hr,
|
|
|
|
ar
|
2020-07-16 22:11:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const i18n = new VueI18n({
|
|
|
|
locale: DEFAULT_LANG,
|
|
|
|
fallbackLocale: DEFAULT_LANG,
|
2020-07-29 14:29:25 +00:00
|
|
|
messages: locales,
|
|
|
|
pluralizationRules: {
|
2020-07-29 16:41:08 +00:00
|
|
|
/**
|
|
|
|
* @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) {
|
2020-07-29 14:29:25 +00:00
|
|
|
var n = Math.abs(choice) % 100
|
|
|
|
var n1 = n % 10
|
2020-07-29 16:41:08 +00:00
|
|
|
|
|
|
|
if (n > 10 && n < 20) {
|
2020-07-29 20:11:47 +00:00
|
|
|
return 2
|
2020-07-29 16:41:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (n1 > 1 && n1 < 5) {
|
2020-07-29 20:11:47 +00:00
|
|
|
return 1
|
2020-07-29 16:41:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (n1 == 1) {
|
2020-07-29 20:11:47 +00:00
|
|
|
return 0
|
2020-07-29 16:41:08 +00:00
|
|
|
}
|
|
|
|
|
2020-07-29 20:11:47 +00:00
|
|
|
return 2
|
2020-07-29 16:41:08 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-16 22:11:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
export default i18n
|