-
Is it possible to load locale from JS over JSON? I'd rather not decouple key constants and pass strings around in the UI. JS files give me the ability to set key values as constants which can then be used in components w/o fear of typos, etc. Anyone have any good suggestions? Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
aralroca
May 9, 2023
Replies: 1 comment 1 reply
-
yes, you can use any format, you can import in your way using {
// ...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),
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
aralroca
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes, you can use any format, you can import in your way using
loadLocalesFrom
config fromi18n.js
, the only thing is to return a Promise with the JSON: