This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/plugins/globals.js

21 lines
664 B
JavaScript

import Vue from 'vue'
import t from '../src/translator';
import config from '../data/config.suml';
import {buildDict} from "../src/helpers";
export default ({ app }) => {
Vue.prototype.$base = process.env.BASE_URL;
Vue.prototype.$t = t;
Vue.prototype.config = config;
Vue.prototype.locales = buildDict(function* () {
if (config.locale !== '_') {
yield [ config.locale, process.env.LOCALES[config.locale] ];
}
for (let l in process.env.LOCALES) {
if (process.env.LOCALES.hasOwnProperty(l) && l !== config.locale) {
yield [l, process.env.LOCALES[l]];
}
}
});
}