locale-nestjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

locale-nestjs

Description

Locale package for NestJs

Instalation

npm i --save locale-nestjs

Quick Start

  1. Create a folder called 'dictionaries' on your 'src' project folder.
  2. On folder 'dictionaries' insert json files with translations, each file must have a name according to its locale (ex: en, pt-BR, etc..)
  3. Import LocaleModule and use forRoot or forRootAsync static methods on your AppModule for initial configuration (see parameters for configuration on LocaleConfig and LocaleConfigAsync files).
  4. Import LocaleService on your service or controller and use defineLanguage method to define current language, and translate method to return the translated message.
  5. Optionally you can use LocaleInterceptor on your project, this interceptor defines the current language according to 'Accept-Language' header on request.

Readme

Keywords

Package Sidebar

Install

npm i locale-nestjs

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

37.1 kB

Total Files

28

Last publish

Collaborators

  • devmontagnini