You've already forked AstralRinth
forked from xxxOFFxxx/AstralRinth
* feat: remove nuxt i18n for in house * cleanup: remove old nuxt/i18n patch * prepr --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
24 lines
564 B
TypeScript
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)
|
|
},
|
|
}
|