Localization

 

Localization methods

The formatting rules can be also applied by the localization methods in views:

<ng-container *translate="let t; ^let l = localize^^'">
  <div>{{ ^l.number^^( height ) }}</div>
  <div>{{ ^l.percent^^( rate ) }}</div>
  <div>{{ ^l.currency^^( [ price, 'EUR' ] ) }}</div>
  <div>{{ ^l.datetime^^( now ) }}</div>
</ng-container>

The number(), percent(), currency() and datetime() methods have the same parameters:

<ng-container *translate="let t; ^let l = localize^^'">
  <div>{{ ^l.number^^( height, 'maxfd=2' ) }}</div>
  <div>{{ ^l.percent^^( rate, 'minfd=1' ) }}</div>
  <div>{{ ^l.currency^^( [ price, 'EUR' ], 'minsd=2' ) }}</div>
  <div>{{ ^l.datetime^^( now, '-' ) }}</div>
</ng-container>

The currency method has an alternate version ccy that accepts separate value and currency code:

<ng-container *translate="let t; ^let l = localize^^'">
  <div>{{ ^l.ccy^^( price, 'HUF' ) }}</div>
  <div>{{ ^l.ccy^^( price, 'HUF', 'minfd=0;maxfd=0' ) }}</div>
</ng-container>