How to use β i18n β
Register translations on defineRaclettePluginFrontend in frontend/index.ts, then read them with usePluginApi().$i18n in widgets.
Register locales β
typescript
export default defineRaclettePluginFrontend({
i18n: {
"en-EU": {
myFeature: { title: "Hello" },
},
"de-EU": {
myFeature: { title: "Hallo" },
},
},
})Use the same locale ids as your app (raclette.config β Getting started).
Use in a widget β
typescript
const { $i18n } = usePluginApi()
const title = computed(() => $i18n.t("myFeature.title"))Another pluginβs strings: usePluginApi("author__other").$i18n.
Tips β
- Nested keys (
feature.action) stay easier to maintain than long flat names. - Provide at least en-EU; do not assume every locale exists at runtime.