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>
This commit is contained in:
Calum H.
2026-01-15 23:49:38 +00:00
committed by GitHub
parent 4497131206
commit a903e46be9
16 changed files with 275 additions and 787 deletions

View File

@@ -8,7 +8,7 @@ import { createPinia } from 'pinia'
import { createApp } from 'vue'
import App from '@/App.vue'
import i18n from '@/i18n.config'
import i18nPlugin from '@/plugins/i18n'
import router from '@/routes'
const vueScan = new VueScanPlugin({
@@ -43,6 +43,6 @@ app.use(FloatingVue, {
},
},
})
app.use(i18n)
app.use(i18nPlugin)
app.mount('#app')

View File

@@ -0,0 +1,23 @@
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)
},
}