Merge branch 'release' into develop

This commit is contained in:
SabreCat
2021-11-22 11:27:46 -06:00
4 changed files with 29 additions and 22 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.211.2",
"version": "4.211.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.211.2",
"version": "4.211.8",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.16.0",
+4 -1
View File
@@ -406,7 +406,10 @@ export default {
this.$store.state.isUserLoaded = true;
Analytics.setUser();
Analytics.updateUser();
return axios.get('/api/v4/i18n/browser-script', { language: this.user.preferences.language });
}).then(() => {
const i18nData = window && window['habitica-i18n'];
this.$loadLocale(i18nData);
this.hideLoadingScreen();
// Adjust the timezone offset
+23 -19
View File
@@ -4,28 +4,32 @@
import moment from 'moment';
import i18n from '@/../../common/script/i18n';
function loadLocale (i18nData) {
// Load i18n strings
i18n.strings = i18nData.strings;
// Load Moment.js locale
const { language } = i18nData;
if (language && i18nData.momentLang && language.momentLangCode) {
// Make moment available under `window` so that the locale can be set
window.moment = moment;
// Execute the script and set the locale
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.type = 'text/javascript';
script.text = i18nData.momentLang;
head.appendChild(script);
moment.locale(language.momentLangCode);
}
}
export default {
install (Vue, { i18nData }) {
if (i18nData) {
// Load i18n strings
i18n.strings = i18nData.strings;
if (i18nData) loadLocale(i18nData);
// Load Moment.js locale
const { language } = i18nData;
if (language && i18nData.momentLang && language.momentLangCode) {
// Make moment available under `window` so that the locale can be set
window.moment = moment;
// Execute the script and set the locale
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.type = 'text/javascript';
script.text = i18nData.momentLang;
head.appendChild(script);
moment.locale(language.momentLangCode);
}
}
Vue.prototype.$loadLocale = loadLocale;
Vue.prototype.$t = function translateString (...args) {
return i18n.t.apply(null, [...args]);