3

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

Sham Dhiman
  • 1,348
  • 1
  • 21
  • 59
BartusZak
  • 1,041
  • 14
  • 21

2 Answers2

1

You have to setup default currency: PLN. Here is example:

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

registerLocaleData(localePl);
...
providers: 
[
    { provide: LOCALE_ID, useValue: 'pl' },
    { provide: DEFAULT_CURRENCY_CODE, useValue: 'PLN' }
],
Qba
  • 148
  • 1
  • 7
  • 25
0

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

siddharth shah
  • 1,139
  • 1
  • 9
  • 17