17.3.12 • Published 5 months ago

@vcd/i18n v17.3.12

Weekly downloads
47
License
-
Repository
-
Last release
5 months ago

I18n

The library of translation utilities provided to internationalize VMware Cloud Director. VCD UI plugin developers can install this library to translate their app and have a reduced bundle size.

To install

npm install @vcd/i18n for the latest stable release or npm install @vcd/i18n@next for the upcoming release, which could contain APIs that may not be stable

Usage

In your App Module, import the I18nModule.forRoot or I18nModule.forChild. Use forRoot if you want to use a translation service singleton that does not change depending on route loaded, but use forChild if you want a translation service that is only loaded for the current non-lazy route.

I.E.:

imports: [
    ...
    I18nModule.forRoot(),
    ...
]

Then, in the constructor of your App Module, inject the TranslationService and call registerTranslations. If you wish to load translations as imported Typescript files, pass the relevant TranslationSet. If you wish to load via HTTP, pass no arguments.

Example:

constructor(translationService: TranslationService) {
    translationService.registerTranslations(TRANSLATIONS);
}

With the setup done, in any component files, you can now inject the TranslationService and use it to translate keys, or you can use the TranslationPipe in any HTML files to translate strings:

<span class="title">{{ 'app.title' | translate }}</span>

Build

Run nx build i18n to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run nx test i18n to execute the unit tests via Karma.

17.3.12

5 months ago

17.1.2

8 months ago

15.0.1

2 years ago

13.0.0

2 years ago

12.0.0

3 years ago

1.0.0-dev.1

4 years ago

1.0.0-dev.0

4 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago