packages/ui/src/lib/symbol/symbol.module.ts
Collects all localization related components and services.
You can setup localization via the SymbolService:
import en from './en';
@Component({
templateUrl: './app.component.html',
})
export class AppComponent {
constructor(private symbols: SymbolService) {
this.symbols.set(en);
}
}
It is expected that you pass an array of Symbol's to SymbolService#set
If you are using datepickers, you have to include the following line to your root component:
moment.locale(this.symbols.resolve('moment.locale'));
To translate symbols in a template, use the symbol pipe:
{{'symbol.language' | symbol}} <!-- prints your current selected language -->
The names of the symbols act as unique identifier, meaning you can overwrite any preexisting symbols. The default preexisting symbols of ec.components can be looked up here, or directly at the source: EN, DE
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SymbolService } from './symbol.service';
import { SymbolPipe } from './symbol.pipe';
/**
* Collects all localization related components and services.
*/
@NgModule({
imports: [CommonModule],
declarations: [SymbolPipe],
exports: [SymbolPipe],
providers: [SymbolService],
})
export class SymbolModule {}