Search code examples
angularlocale

Polish locales in Angular 4+


I'm trying to set static locales of my angular 6 project. After changing everything correctly to the documentation it is still displaying en-US locales.

main.ts

import { NgModule, LOCALE_ID } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import localePl from '@angular/common/locales/pl';

registerLocaleData(localePl);
...
providers: [
    { provide: LOCALE_ID, useValue: 'pl' }
  ],

.html

<div>
  <h2>
    Razem do zapłaty:<span>{{ toPay | currency }}</span>
  </h2>
</div>

Image of not translated text

Screen Shot


Solution

  • I am not sure this is the correct locale for polish, but you will need to use it in such a manner like this:-

    <div>
          <h2>
            Razem do zapłaty:<span>{{ toPay | currency:'PLN': true }}</span>
          </h2>
        </div>
    

    Please try this hope this works