dependencies Legend  Declarations  Module  Bootstrap  Providers  Exports cluster_SymbolModule cluster_SymbolModule_providers cluster_SymbolModule_exports cluster_SymbolModule_declarations SymbolPipe SymbolPipe SymbolModule SymbolModule SymbolPipe->SymbolModule SymbolPipe SymbolPipe SymbolModule->SymbolPipe SymbolService SymbolService SymbolService->SymbolModule

File

packages/ui/src/lib/symbol/symbol.module.ts

Description

Collects all localization related components and services.

Declarations

Providers

Exports

Localization

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

Date Localization

If you are using datepickers, you have to include the following line to your root component:

moment.locale(this.symbols.resolve('moment.locale'));

Using symbols in templates

To translate symbols in a template, use the symbol pipe:

{{'symbol.language' | symbol}} <!-- prints your current selected language -->

Overwriting

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

result-matching ""

    No results matching ""