2020-09-28 08:51:26 -07:00
|
|
|
import Vue from 'vue'
|
|
|
|
import t from '../src/translator';
|
2020-09-28 09:29:13 -07:00
|
|
|
import config from '../data/config.suml';
|
2020-10-17 09:19:11 -07:00
|
|
|
import {buildDict} from "../src/helpers";
|
2020-09-28 08:51:26 -07:00
|
|
|
|
2020-12-27 08:52:21 -08:00
|
|
|
export default ({ app, store }) => {
|
2021-01-06 06:21:20 -08:00
|
|
|
Vue.prototype.$eventHub = new Vue();
|
2020-11-10 14:41:56 -08:00
|
|
|
Vue.prototype.$base = process.env.BASE_URL;
|
2020-09-28 08:51:26 -07:00
|
|
|
Vue.prototype.$t = t;
|
2020-12-08 15:04:42 -08:00
|
|
|
Vue.prototype.$translateForPronoun = (str, pronoun) =>
|
|
|
|
pronoun.format(
|
2021-03-05 11:05:56 -08:00
|
|
|
t(`flags.${str.replace(/ /g, '_').replace(/'/g, `*`)}`, {}, false) || str
|
2020-12-08 15:04:42 -08:00
|
|
|
);
|
2020-09-28 09:29:13 -07:00
|
|
|
Vue.prototype.config = config;
|
2020-10-17 09:19:11 -07:00
|
|
|
Vue.prototype.locales = buildDict(function* () {
|
2020-10-28 08:22:29 -07:00
|
|
|
if (config.locale !== '_') {
|
2020-11-12 12:32:07 -08:00
|
|
|
yield [ config.locale, process.env.LOCALES[config.locale] ];
|
2020-10-28 08:22:29 -07:00
|
|
|
}
|
2020-11-12 12:32:07 -08:00
|
|
|
for (let l in process.env.LOCALES) {
|
|
|
|
if (process.env.LOCALES.hasOwnProperty(l) && l !== config.locale) {
|
|
|
|
yield [l, process.env.LOCALES[l]];
|
2020-10-17 09:19:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-12-27 08:52:21 -08:00
|
|
|
store.commit('setSpelling', app.$cookies.get('spelling') || 'traditional');
|
2021-01-17 10:41:07 -08:00
|
|
|
Vue.prototype.buildImageUrl = (imageId, size) => `${process.env.BUCKET}/images/${imageId}-${size}.png`
|
2020-09-28 08:51:26 -07:00
|
|
|
}
|