Setup Backbone i18n

14313-map-button-tests
jesusbotella 6 years ago
parent cec7795e38
commit 711c4e1da4

@ -0,0 +1,14 @@
var ACTIVE_LOCALE = 'en';
if (ACTIVE_LOCALE !== 'en') {
require('moment/locale/' + ACTIVE_LOCALE);
}
var Locale = require('locale/index');
var Polyglot = require('node-polyglot');
var polyglot = new Polyglot({
locale: ACTIVE_LOCALE, // Needed for pluralize behaviour
phrases: Locale[ACTIVE_LOCALE]
});
window._t = polyglot.t.bind(polyglot);

@ -1,5 +1,6 @@
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import './backbone-i18n';
// Locales
import en from 'new-dashboard/i18n/locales/en';

@ -1,18 +0,0 @@
import Vue from 'vue';
import ConfigModel from 'dashboard/data/config-model';
import UserModel from 'dashboard/data/user-model';
const BackboneCoreModels = {};
BackboneCoreModels.install = function (Vue, options) {
Vue.mixin({
beforeCreate () {
this.$cartoModels = options;
}
});
};
Vue.use(BackboneCoreModels, {
config: new ConfigModel(window.CartoConfig.data.config),
user: new UserModel(window.CartoConfig.data.user_data)
});

@ -0,0 +1,33 @@
import Vue from 'vue';
// Backbone Models
import ConfigModel from 'dashboard/data/config-model';
import UserModel from 'dashboard/data/user-model';
import BackgroundPollingModel from 'dashboard/data/background-polling/dashboard-background-polling-model';
const BackboneCoreModels = {};
BackboneCoreModels.install = function (Vue, options) {
Vue.mixin({
beforeCreate () {
this.$cartoModels = options;
}
});
};
const configModel = new ConfigModel({
...window.CartoConfig.data.config,
base_url: window.CartoConfig.data.user_data.base_url
});
const userModel = new UserModel(window.CartoConfig.data.user_data);
const backgroundPollingModel = new BackgroundPollingModel({
showGeocodingDatasetURLButton: true,
geocodingsPolling: true,
importsPolling: true
}, { configModel, userModel });
Vue.use(BackboneCoreModels, {
config: configModel,
user: userModel,
backgroundPolling: backgroundPollingModel
});
Loading…
Cancel
Save