ng-multilang
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 {}