Make locale url also work with nested wordpress backend.

This commit is contained in:
HenriT
2021-08-30 20:12:17 +03:00
parent dd9faff7bd
commit e4e0c6cfb2
2 changed files with 7 additions and 3 deletions

View File

@ -11,12 +11,16 @@ i18next
.use(LanguageDetector)
.use(Backend);
console.log(process.env.BASE_URL);
const path = window.name
? JSON.parse(window.name).front_url
: `${window.location.origin}${process.env.BASE_URL}`;
const initialized = i18next.init({
fallbackLng: 'en',
whitelist: ['en', 'fr', 'et', 'fa', 'bn', 'es'],
backend: {
loadPath: `${window.location.origin}${process.env.BASE_URL}/locales/{{lng}}/{{ns}}.json`,
loadPath: `${path}/locales/{{lng}}/{{ns}}.json`,
},
detection: {
order: ['querystring', 'path', 'localStorage', 'navigator'],

View File

@ -3,7 +3,7 @@ import app from '@/main';
import NotificationService from '@/services/notification.service';
import { removeVuexORMFlags } from '@/utils/helpers';
const config = window.name ? JSON.parse(window.name) : { api_url: '', nonce: '' };
const config = window.name ? JSON.parse(window.name) : { front_url: '', api_url: '', nonce: '' };
const http = axios.create({
baseURL: config.api_url,