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

@@ -0,0 +1,24 @@
import type { InjectionKey, Ref } from 'vue'
import { inject, provide } from 'vue'
// This doesn't use the architecture outlined in index.ts as it needs some custom checks + use the symbol
export interface I18nContext {
locale: Ref<string>
t: (key: string, values?: Record<string, unknown>) => string
setLocale: (locale: string) => Promise<void> | void
}
export const I18N_INJECTION_KEY: InjectionKey<I18nContext> = Symbol('i18n')
export function injectI18n(): I18nContext {
const context = inject(I18N_INJECTION_KEY)
if (!context) {
throw new Error('Injection `Symbol(i18n)` not found. Ensure the i18n plugin is installed.')
}
return context
}
export function provideI18n(context: I18nContext): I18nContext {
provide(I18N_INJECTION_KEY, context)
return context
}

View File

@@ -79,6 +79,7 @@ export function createContext<ContextValue>(
}
export * from './api-client'
export * from './i18n'
export * from './page-context'
export * from './project-page'
export * from './server-context'