nestjs-i18n
Classes
- AcceptLanguageResolver
- CookieResolver
- GraphQLWebsocketResolver
- GrpcMetadataResolver
- HeaderResolver
- I18nAbstractLoader
- I18nContext
- I18nJsonLoader
- I18nLanguageInterceptor
- I18nLoader
- I18nMiddleware
- I18nModule
- I18nService
- I18nValidationException
- I18nValidationExceptionFilter
- I18nValidationPipe
- I18nYamlLoader
- QueryResolver
Interfaces
- I18nAbstractLoaderOptions
- I18nAsyncOptions
- I18nOptions
- I18nOptionsFactory
- I18nPluralObject
- I18nResolver
- I18nTranslation
- I18nTranslator
- I18nValidationExceptionFilterDetailedErrorsOption
- I18nValidationExceptionFilterErrorFormatterOption
- OptionsProvider
Type Aliases
Formatter
Ƭ Formatter: (template
: string
, ...args
: (string
| Record
<string
, string
>)[]) => string
Type declaration
▸ (template
, ...args
): string
Parameters
Name | Type |
---|---|
template | string |
...args | (string | Record <string , string >)[] |
Returns
string
Defined in
src/interfaces/i18n-options.interface.ts:38
I18nOptionResolver
Ƭ I18nOptionResolver: ResolverWithOptions
| Type
<I18nResolver
> | I18nResolver
Defined in
src/interfaces/i18n-options.interface.ts:33
I18nOptionsWithoutResolvers
Ƭ I18nOptionsWithoutResolvers: Omit
<I18nOptions
, "resolvers"
| "loader"
>
Defined in
src/interfaces/i18n-options.interface.ts:28
I18nValidationError
Ƭ I18nValidationError: ValidationError
Defined in
src/interfaces/i18n-validation-error.interface.ts:3
I18nValidationPipeOptions
Ƭ I18nValidationPipeOptions: Omit
<ValidationPipeOptions
, "exceptionFactory"
>
Defined in
src/pipes/i18n-validation.pipe.ts:9
I18nValidatorOptions
Ƭ I18nValidatorOptions: ValidatorOptions
Defined in
src/interfaces/i18n-options.interface.ts:78
OptionProvider
Ƭ OptionProvider<T
>: Omit
<ClassProvider
<T
>, "provide"
> | Omit
<ValueProvider
<T
>, "provide"
> | Omit
<FactoryProvider
<T
>, "provide"
> | Omit
<ExistingProvider
<T
>, "provide"
> | OptionsProvider
Type parameters
Name | Type |
---|---|
T | any |
Defined in
src/interfaces/i18n-options.interface.ts:17
Path
Ƭ Path<T
>: keyof T
extends string
? PathImpl2
<T
> extends infer P ? P
extends string
| keyof T
? P
: keyof T
: keyof T
: never
Type parameters
Name |
---|
T |
Defined in
PathValue
Ƭ PathValue<T
, P
>: P
extends `${infer Key}.${infer Rest}` ? Key
extends keyof T
? Rest
extends Path
<T
[Key
]> ? PathValue
<T
[Key
], Rest
> : never
: never
: P
extends keyof T
? T
[P
] : never
Type parameters
Name | Type |
---|---|
T | T |
P | extends Path <T > |
Defined in
ResolverWithOptions
Ƭ ResolverWithOptions: { use
: Type
<I18nResolver
> } & OptionProvider
Defined in
src/interfaces/i18n-options.interface.ts:24
TranslateOptions
Ƭ TranslateOptions: Object
Type declaration
Name | Type |
---|---|
args? | ({ [k: string] : any ; } | string )[] | { [k: string] : any ; } |
debug? | boolean |
defaultValue? | string |
lang? | string |
Defined in
src/services/i18n.service.ts:27
Variables
I18N_LANGUAGES
• Const
I18N_LANGUAGES: "I18nLanguages"
Defined in
I18N_LOADER_OPTIONS
• Const
I18N_LOADER_OPTIONS: "I18nLoaderOptions"
Defined in
I18N_OPTIONS
• Const
I18N_OPTIONS: "I18nOptions"
Defined in
I18N_RESOLVERS
• Const
I18N_RESOLVERS: "I18nResolvers"
Defined in
I18N_RESOLVER_OPTIONS
• Const
I18N_RESOLVER_OPTIONS: "I18nResolverOptions"
Defined in
I18N_TRANSLATIONS
• Const
I18N_TRANSLATIONS: "I18nTranslations"
Defined in
logger
• Const
logger: Logger
Defined in
Functions
I18n
▸ I18n(...dataOrPipes
): ParameterDecorator
Defines HTTP route param decorator
Parameters
Name | Type |
---|---|
...dataOrPipes | any [] |
Returns
ParameterDecorator
Public Api
Defined in
node_modules/@nestjs/common/decorators/http/create-route-param-metadata.decorator.d.ts:12
I18nLang
▸ I18nLang(...dataOrPipes
): ParameterDecorator
Defines HTTP route param decorator
Parameters
Name | Type |
---|---|
...dataOrPipes | any [] |
Returns
ParameterDecorator
Public Api
Defined in
node_modules/@nestjs/common/decorators/http/create-route-param-metadata.decorator.d.ts:12
I18nLanguages
▸ I18nLanguages(): (target
: object
, key
: string
| symbol
, index?
: number
) => void
Returns
fn
▸ (target
, key
, index?
): void
Decorator that marks a constructor parameter as a target for Dependency Injection (DI).
Any injected provider must be visible within the module scope (loosely speaking, the containing module) of the class it is being injected into. This can be done by:
- defining the provider in the same module scope
- exporting the provider from one module scope and importing that module into the module scope of the class being injected into
- exporting the provider from a module that is marked as global using the
@Global()
decorator
Injection tokens
Can be types (class names), strings or symbols. This depends on how the
provider with which it is associated was defined. Providers defined with the
@Injectable()
decorator use the class name. Custom Providers may use strings
or symbols as the injection token.
Parameters
Name | Type |
---|---|
target | object |
key | string | symbol |
index? | number |
Returns
void
See
Public Api
Defined in
src/decorators/i18n-languages.decorator.ts:4
I18nResolverOptions
▸ I18nResolverOptions(): any
Returns
any
Defined in
src/decorators/i18n-resolver-options.decorator.ts:8
getContextObject
▸ getContextObject(context?
): any
Parameters
Name | Type |
---|---|
context? | ExecutionContext | ArgumentsHost |
Returns
any
Defined in
getI18nResolverOptionsToken
▸ getI18nResolverOptionsToken(target
): string
Parameters
Name | Type |
---|---|
target | () => void |
Returns
string
Defined in
src/decorators/i18n-resolver-options.decorator.ts:4
i18nValidationErrorFactory
▸ i18nValidationErrorFactory(errors
): I18nValidationException
Parameters
Name | Type |
---|---|
errors | ValidationError [] |
Returns
Defined in
i18nValidationMessage
▸ i18nValidationMessage<K
>(key
, args?
): (a
: ValidationArguments
) => string
Type parameters
Name | Type |
---|---|
K | Record <string , unknown > |
Parameters
Name | Type |
---|---|
key | Path <K > |
args? | any |
Returns
fn
▸ (a
): string
Parameters
Name | Type |
---|---|
a | ValidationArguments |
Returns
string