15.0.1 • Published 1 year ago

@vcd/i18n v15.0.1

Weekly downloads
47
License
-
Repository
-
Last release
1 year 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.

15.0.1

1 year ago

13.0.0

2 years ago

12.0.0

2 years ago

1.0.0-dev.1

4 years ago

1.0.0-dev.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago