NuxtN
Nuxt2y ago
reflex

i18n dynamically load locale files

I am trying to load lazy json file with translations

export default async (context) => {
  return await new Promise((resolve, reject) => {
    context.$axios
      .get('/static/lang/cs-CZ.json')
      .then((response) => {
        resolve(response.data)
      })
      .catch((error) => {
        reject(error)
      })
  })
}

But it make SSR return translation keys and then call ajax call which load messages from json

Any idea?
Was this page helpful?