@toolstik/ng-multilang
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

ng-multilang

npm version Coverage Status angular-open-source-starter

ng-multilang is a tiny library to work with multilingual strings like:

{
    en: 'Hello World!',
    ru: 'Привет Мир!'
}

What does it do?

This library contains types and Angular module to work with such kind of data

How to use it?

import {NgModule} from '@angular/core';
import {MultiLangModule} from '@toolstik/ng-multilang';
import {TranslateModule, TranslateService} from '@ngx-translate/core';

export const SupportedLangsArray = ['en', 'ru'] as const;

@NgModule({
    imports: [
        TranslateModule.forRoot(),
        MultiLangModule.forRoot({
            supportedLangs: [...SupportedLangsArray],
            currentLang: {
                inject: [TranslateService],
                factory: (translate: TranslateService) => () => translate.currentLang,
            },
        }),
    ],
})
export class AppModule {}

Package Sidebar

Install

npm i @toolstik/ng-multilang

Weekly Downloads

1

Version

1.0.1

License

Apache-2.0

Unpacked Size

176 kB

Total Files

33

Last publish

Collaborators

  • toolstik