Skip to content

Loading locales from JS files over JSON #1042

Answered by aralroca
mikey-mo asked this question in General
Discussion options

You must be logged in to vote

yes, you can use any format, you can import in your way using loadLocalesFrom config from i18n.js, the only thing is to return a Promise with the JSON:

{
  // ...rest of config
  "loadLocaleFrom": (lang, ns) =>
    // You can use a dynamic import, fetch, whatever. You should
    // return a Promise with the JSON file.
    import(`./locales/${lang}/${ns}.js`).then((m) => m.default),
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mikey-mo
Comment options

Answer selected by aralroca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1039 on May 09, 2023 08:03.