2

I have a SPA (Vuejs with VueI18n and VueRouter) with Webpack. Everything works fine when I run the App Local in the integrated server.

Now well, if I builde the app and have only Static Files - the routing /de or /en does not work anymore. I have the Static application in the public folder of Strapi (yes I know, is actually not the purpose for that). But it would be great if someone has a pragmatic solution, because I am a bit pressed for time regarding my master thesis. :frowning:

Ahh one more thing, the Static App works in the Strapi Public Folder - just not with the language routing (/de or /en)

Strapi version 3.6.8 Vue 2.6.11 Vue-i18n 8.27.1 Vue-router 3.4.3

Thanks in advance! Here some more relevant code:

import { messages, defaultLocale } from "./i18n";
var locale = window.location.pathname.replace(/^\/([^\/]+).*/i,'$1');

const i18n = new VueI18n({
    messages,
    locale: (locale.trim().length && locale != "/") ? locale : defaultLocale,
    fallbackLocale: defaultLocale
});
const routes = [
    { path: '/', component: App },
]

const router = new VueRouter({
    base: (locale.trim().length && locale != "/") ? '/' + locale : undefined,
    mode: 'history',
    routes: routes
});


new Vue({
    i18n,
    router,
    render: h => h(App)
}).$mount(".app");

1 Answers1

0

Solved! Load language parameters via a # so for example .html#/en