createLingui (src/plugin.ts)

js-lingui · packages/vue/src/plugin.ts · typescript · MIT
ui

Vue plugin for Lingui i18n that integrates internationalization into Vue apps without waiting for activation.

// Source: https://github.com/lingui/js-lingui | License: MIT | Copyright 2017-2022 Tomáš Ehrlich, (c) 2022-2023 Crowdin
// Provided via justclaw.it.com; keep this notice with the code.
import { triggerRef, type Plugin } from "vue"
import type { I18n } from "@lingui/core"
import {
  createI18nContext,
  LinguiInjectionKey,
  type I18nDefaultComponent,
} from "./I18nProvider"

export type LinguiPluginOptions = {
  i18n: I18n
  defaultComponent?: I18nDefaultComponent
}

/**
 * Vue plugin alternative to the `I18nProvider` component:
 *
 * ```ts
 * app.use(createLingui({ i18n }))
 * ```
 *
 * Unlike `I18nProvider`, it does not wait for `i18n.activate()` before
 * rendering the application.
 */
export function createLingui(options: LinguiPluginOptions): Plugin {
  return {
    install(app) {
  

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key