<commit_before>
import Vue from 'vue';
import vuexI18n from 'vuex-i18n';

import store from '../store';
import locales from './locales';

import fallback from '../assets/i18n/en.json';

Vue.use(vuexI18n.plugin, store);

Vue.i18n.add('en', fallback);
Vue.i18n.set('en');
Vue.i18n.fallback('en');

export default {
    init() {
        let userLang = window.localStorage.getItem('contao_manager_locale');

        if (!userLang) {
            userLang = navigator.language || navigator.userLanguage;
        }

        return this.load(userLang);
    },

    load(locale) {
        window.localStorage.setItem('contao_manager_locale', locale);

        if (Vue.i18n.exists(locale)) {
            Vue.i18n.set(locale);<commit_msg>Update to latest i18n API<commit_after>
import Vue from 'vue';
import vuexI18n from 'vuex-i18n';

import store from '../store';
import locales from './locales';

import fallback from '../assets/i18n/en.json';

Vue.use(vuexI18n.plugin, store);

Vue.i18n.add('en', fallback);
Vue.i18n.set('en');
Vue.i18n.fallback('en');

export default {
    init() {
        let userLang = window.localStorage.getItem('contao_manager_locale');

        if (!userLang) {
            userLang = navigator.language || navigator.userLanguage;
        }

        return this.load(userLang);
    },

    load(locale) {
        window.localStorage.setItem('contao_manager_locale', locale);

        if (Vue.i18n.localeExists(locale)) {
            Vue.i18n.set(locale);
{'fraction_non_alphanumeric': 0.14945652173913043, 'fraction_numerical': 0.025815217391304348, 'mean_word_length': 3.0578512396694215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '64792', 'n_tokens_mistral': 539, 'n_tokens_neox': 513, 'n_words': 95}