Class: I18nContext<K>
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Implements
Constructors
constructor
• new I18nContext<K
>(lang
, service
)
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Parameters
Name | Type |
---|---|
lang | string |
service | I18nService <K > |
Defined in
Properties
id
• Readonly
id: number
Defined in
lang
• Readonly
lang: string
Defined in
service
• Readonly
service: I18nService
<K
>
Defined in
counter
▪ Static
Private
counter: number
= 1
Defined in
storage
▪ Static
Private
storage: AsyncLocalStorage
<I18nContext
<Record
<string
, unknown
>>>
Defined in
Accessors
i18n
• get
i18n(): I18nContext
<K
>
Returns
I18nContext
<K
>
Defined in
Methods
t
▸ t<P
, R
>(key
, options?
): IfAnyOrNever
<R
, string
, R
>
Type parameters
Name | Type |
---|---|
P | extends string = any |
R | PathValue <K , P > |
Parameters
Name | Type |
---|---|
key | P |
options? | TranslateOptions |
Returns
IfAnyOrNever
<R
, string
, R
>
Implementation of
Defined in
translate
▸ translate<P
, R
>(key
, options?
): IfAnyOrNever
<R
, string
, R
>
Type parameters
Name | Type |
---|---|
P | extends string = any |
R | PathValue <K , P > |
Parameters
Name | Type |
---|---|
key | P |
options? | TranslateOptions |
Returns
IfAnyOrNever
<R
, string
, R
>
Implementation of
Defined in
validate
▸ validate(value
, options?
): Promise
<ValidationError
[]>
Parameters
Name | Type |
---|---|
value | any |
options? | TranslateOptions |
Returns
Promise
<ValidationError
[]>
Implementation of
Defined in
create
▸ Static
create(ctx
, next
): void
Parameters
Name | Type |
---|---|
ctx | I18nContext <Record <string , unknown >> |
next | (...args : any []) => void |
Returns
void
Defined in
createAsync
▸ Static
createAsync<T
>(ctx
, next
): Promise
<T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
ctx | I18nContext <Record <string , unknown >> |
next | (...args : any []) => Promise <T > |
Returns
Promise
<T
>
Defined in
current
▸ Static
current<K
>(context?
): I18nContext
<K
>
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Parameters
Name | Type |
---|---|
context? | ArgumentsHost |
Returns
I18nContext
<K
>