Problem with localization

Hi Team,

I try to localize DatePicker to polish language but without success. What am I doing wrong?

import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

import { L10n, registerLicense } from '@syncfusion/ej2-base';
import {setCulture, setCurrencyCode} from '@syncfusion/ej2-base';
import { loadCldr } from '@syncfusion/ej2-base';
import { GlobalSP_Lista } from './app/_sqlogic/globalsp_lista';
import { StVat } from './app/_sqlogic/stvat';
import plNumberData from "@syncfusion/ej2-cldr-data/main/pl/numbers.json";
import plGregorian from "@syncfusion/ej2-cldr-data/main/pl/ca-gregorian.json";

// Registering Syncfusion license key
setCulture('pl');
setCurrencyCode('PLN');
loadCldr(plNumberData, plGregorian);
fetch('./pl.json')
  .then(response => response.json())
  .then(data => {
    L10n.load(data);
});
GlobalSP_Lista.ustawListy();
StVat.ustawStawki((new Date()).getFullYear(), '23|8|5|0|zw|np');

bootstrapApplication(AppComponent, appConfig).catch((err) =>
  console.error(err)
);


5 Replies

PK Priyanka Karthikeyan Syncfusion Team April 3, 2025 01:51 PM UTC

Hi Roman Sznajder,


Thank you for reaching out to us. 

 

To properly load the "pl" culture in the Angular DatePicker component, we have created a sample based on your requirements. Please find the code snippet and attached sample for your reference.

 

app.component.html

 

<ejs-datepicker   [locale]="locale"></ejs-datepicker

 

app.component.ts

import { Component, Input, ViewEncapsulation } from '@angular/core';
import { loadCldr, L10n } from '@syncfusion/ej2-base';
import * as numbers from 'cldr-data/main/pl/numbers.json';
import * as gregorian from 'cldr-data/main/pl/ca-gregorian.json';
import * as numberingSystems from 'cldr-data/supplemental/numberingSystems.json';
import * as timeZoneNames from 'cldr-data/main/pl/timeZoneNames.json';
import * as weekData from 'cldr-data/supplemental/weekData.json';

import { DatePickerAllModule } from '@syncfusion/ej2-angular-calendars';
loadCldr(numbers, gregorian, numberingSystems, timeZoneNames, weekData);
@Component({
selector: 'app-root',
standalone: true,
imports: [ DatePickerAllModule],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
encapsulation: ViewEncapsulation.None
})

export class AppComponent {
locale ="pl";
ngOnInit(): void {
   /*loads the localization text*/
   L10n.load({
     'pl': {
       'datepicker': {
         placeholder: 'Enter value'
       }
     }
   });
}
}

 


Regards,

Priyanka K



Attachment: DatePicker_sample_1cadc0d7.zip


RS Roman Sznajder April 3, 2025 03:54 PM UTC

Now works fine, thank you.



PK Priyanka Karthikeyan Syncfusion Team April 4, 2025 04:10 AM UTC

Hi Roman Sznajder,


Thank you for the update. We are glad to hear that the issue has been resolved on your end. Please feel free to reach out to us if you need any further assistance.

 

Regards,

Priyanka K




DR Daryl Ruiz April 4, 2025 08:16 AM UTC

I also using it and it's working properly.



PK Priyanka Karthikeyan Syncfusion Team April 7, 2025 04:41 AM UTC

Hi Daryl Ruiz,


Thank you for the update. We are glad to hear that the issue has been resolved on your end. Please feel free to reach out to us if you need any further assistance.

 

Regards,

Priyanka K


Loader.
Up arrow icon