localization for Norwegian language (Norsk)


Hello! Can I get help with locale for Norwegian language by using dateRangePickerComponent ? ,   We use  in current progect  ngx-translate. Please help!!!



3 Replies

BM Balaji M Syncfusion Team September 17, 2018 12:13 PM UTC

Hi Ali Kholmatov, 

Thanks for contacting Syncfusion Support. 

We would like to let you know that we have provided support for our EJ2 components with L10 load method which allows to localize the components in any culture. Please check the below code snippet to know about how to use the L10 load method to localize the EJ2 DateRangePicker component. 

import { L10n } from '@syncfusion/ej2-base'; 
 
ngOnInit(): void { 
        L10n.load({ 
            'en-US': { 
                'daterangepicker': { 
                    placeholder: 'Velg et område', 
                    startLabel: 'startdato', 
                    endLabel: 'sluttdato', 
                    applyText: 'søke om', 
                    cancelText: 'Avbryt', 
                    selectedDays: 'valgte dager', 
                    days: 'dager', 
                    customRange:'tilpasset utvalg' 
                } 
            } 
        }); 
    } 


Here, we have localized the text content of the DateRangePicker component of the default culture (“en-US”) using the L10 load method. 

To know more about localizing our EJ2 components, please check the below documentation link. 

Link: https://ej2.syncfusion.com/angular/documentation/base/localization.html#loading-translations

To know about globalizing the DateRangePicker component, please check the below documentation link. 


For your convenience we have also attached a simple sample for localizing the DateRangePicker component in the below link. Please check it. 


Also, please ensure that the value of the presets text will be always displayed with the same label which is declared while initializing the DateRangePicker component. 

<ejs-daterangepicker id="daterange"> 
    <e-presets> 
      <!-- for presets the text will be displayed based on the label value being added to each preset irrespective to the culture --> 
                <e-preset label="denne uka" [start]='weekStart' [end]='weekEnd'></e-preset> 
                <e-preset label="denne måneden" [start]='monthStart' [end]='monthEnd'></e-preset> 
                <e-preset label="forrige måned" [start]='lastStart' [end]='lastEnd'></e-preset> 
                <e-preset label="i fjor" [start]='yearStart' [end]='yearEnd'></e-preset> 
            </e-presets> 
</ejs-daterangepicker> 


Please let us know if you need any further assistance. 



Regards, 
M. Balaji  



AK Ali Kholmatov September 17, 2018 01:59 PM UTC

thank you! But  what about name of months or name of weeks? 


DL Deepa Loganathan Syncfusion Team September 18, 2018 12:50 PM UTC

Hi Ali Kholmatov, 

Sorry for the inconvenience. 

We can globalize the DateRangePicker to Norwegian language by changing the locale property to “nb” and loading the corresponding CLDR JSON files required to globalize the component as shown in the below code snippet. 

import { Component } from '@angular/core'; 
import { L10n, loadCldr } from '@syncfusion/ej2-base'; 
 
declare var require: any; 
 
loadCldr( 
  require('cldr-data/supplemental/numberingSystems.json'), 
  require('cldr-data/ supplemental/weekData.json'), 
require('cldr-data/main/nb/ca-gregorian.json'), 
  require('cldr-data/main/nb/numbers.json'), 
  require('cldr-data/main/nb/timeZoneNames.json') 
); 
 
@Component({ 
  selector: 'my-app', 
  template: `<ejs-daterangepicker locale="nb"> 
            <e-presets> 
                <e-preset label="denne uka" [start]='weekStart' [end]='weekEnd'></e-preset> 
                <e-preset label="denne måneden" [start]='monthStart' [end]='monthEnd'></e-preset> 
                <e-preset label="forrige måned" [start]='lastStart' [end]='lastEnd'></e-preset> 
                <e-preset label="i fjor" [start]='yearStart' [end]='yearEnd'></e-preset> 
            </e-presets> 
  </ejs-daterangepicker>`, 
}) 

You can get the detailed information for globalizing the DateRangePicker component from the documentation link. 


For your convenience, we have also attached a simple sample for globalizing the component to Norwegian culture and attached it in the below link. Please check it. 


Please run the below commands to run the sample 

  1. npm install
  2. npm start

Please let us know if you need any further assistance. 

Regards, 
Deepa L. 


Loader.
Up arrow icon