Files
AstralRinth/apps/app-frontend/src/plugins/i18n.ts
Calum H. a903e46be9 feat: remove nuxt i18n for in house i18n for web (#5131)
* feat: remove nuxt i18n for in house

* cleanup: remove old nuxt/i18n patch

* prepr

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
2026-01-15 23:49:38 +00:00

24 lines
564 B
TypeScript

import { I18N_INJECTION_KEY, type I18nContext } from '@modrinth/ui'
import type { App } from 'vue'
import i18n from '@/i18n.config'
export default {
install(app: App) {
// Install vue-i18n as before
app.use(i18n)
// Wrap it in our I18nContext interface
const context: I18nContext = {
locale: i18n.global.locale,
t: (key, values) => i18n.global.t(key, values ?? {}) as string,
setLocale: (newLocale) => {
i18n.global.locale.value = newLocale
},
}
// Provide the context at app-level
app.provide(I18N_INJECTION_KEY, context)
},
}