I18n
in the @sit-onyx/nuxt
package
#2334
-
Hello, @larsrickert I have a question regarding And I've noticed that Suggested way for ( Could you please explain your decision? This can really help us to not make a mistake in early dev stage. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey :) The |
Beta Was this translation helpful? Give feedback.
-
Hi @bergser, I'm not entirely sure which differences you're refering to, maybe you could give an example :) But in general the way our module works is that we check if the nuxt-i18n module is installed parallel to the onyx module. If that's the case we basically "hand over" the handling of translations to nuxt-i18n instead of the default translation handling built into onyx. onyx/packages/nuxt/src/module.ts Line 107 in 5e1b90f The part you linked in your question actually leads to the plugin providing onyx to the nuxt app. (E.g. calling app.use on it to provide global things and so on) This is where we pass the Inside the module we also need to do a bit of mapping from the language codes used by the app to the ones provided by onyx. As nuxt-i18n is pretty flexible in that regard we can't be sure a app e.g. uses standard iso codes. Some apps also have custom locales e.g. "de-INT" which need to manually be mapped to a locale supported by onyx. I hope that clarifies things a bit. In general I don't think we're that much off from the way of doing things recommended by the docs, but we're of course always open for improvement ;) |
Beta Was this translation helpful? Give feedback.
-
@markbrockhoff thank you for the clarification. So my question was more about that plugin and how you are using it, to understand if we should use same approach or not. If I get you right only purpose of it, is to avoid unnecessary nesting in json files, and add |
Beta Was this translation helpful? Give feedback.
Hi @bergser, I'm not entirely sure which differences you're refering to, maybe you could give an example :)
But in general the way our module works is that we check if the nuxt-i18n module is installed parallel to the onyx module. If that's the case we basically "hand over" the handling of translations to nuxt-i18n instead of the default translation handling built into onyx.
To make nuxt-i18n aware of the default translations provided by onyx they are registered like mentioned inside the nuxt-i18n docs. You can find that part here:
onyx/packages/nuxt/src/module.ts
Line 107 in 5e1b90f
The part you linked in your quest…