Aller au contenu principal
Version: Next

MidwayI18nService

Index

Constructors

constructor

Properties

ctx

ctx: Context

Methods

publicaddLocale

  • addLocale(locale: string, localeTextMapping: Record<string, any>): void
  • add a language text mapping

publicgetAvailableLocale

  • getAvailableLocale(locale: string, group?: string): any
  • get locale string by find fallback and default, ignore match message

publicgetDefaultLocale

  • getDefaultLocale(): string
  • get current default language

publicgetLocaleMapping

  • getLocaleMapping(locale: any, group?: string): any
  • get mapping by lang

publichasAvailableLocale

  • hasAvailableLocale(locale: string): boolean
  • get available local in locale text map, include fallbacks

publicsaveRequestLocale

  • saveRequestLocale(locale?: string): void
  • save current context lang to flag, middleware will be set it to cookie

publictranslate