Internationalization Setting

Hi,

I have try to set my culture to "en-GB"  by following the example below.  I am not able able to get it working with the error below. 

http://ej2.syncfusion.com/15.4.17/angular/documentation/base/intl.html

ERROR The specified locale or controlname not found in the locale object
Error: The specified locale or controlname not found in the locale object
    at throwError (webpack-internal:///../../../../@syncfusion/ej2-base/dist/es6/util.js:179:15)
    at L10n.setLocale (webpack-internal:///../../../../@syncfusion/ej2-base/dist/es6/l10n.js:16:82)
    at new L10n (webpack-internal:///../../../../@syncfusion/ej2-base/dist/es6/l10n.js:10:14)
    at ChartComponent.Chart.setCulture (webpack-internal:///../../../../@syncfusion/ej2-charts/dist/es6/chart/chart.js:824:29)
    at ChartComponent.Chart.preRender (webpack-internal:///../../../../@syncfusion/ej2-charts/dist/es6/chart/chart.js:148:14)
    at ChartComponent.Component.refresh (webpack-internal:///../../../../@syncfusion/ej2-base/dist/es6/component.js:81:14)
    at ChartComponent.Chart.addSeries (webpack-internal:///../../../../@syncfusion/ej2-charts/dist/es6/chart/chart.js:569:14)
    at SafeSubscriber.eval [as _next] (webpack-internal:///../../../../../src/app/monitoring/bpressure/bpressure.component.ts:66:27)
    at SafeSubscriber.__tryOrUnsub (webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:244:16)
    at SafeSubscriber.next (webpack-internal:///../../../../rxjs/_esm5/Subscriber.js:191:22)

5 Replies

DD Dharanidharan Dharmasivam Syncfusion Team November 29, 2017 11:18 AM UTC

Hi Albert, 

Thanks for using Syncfusion products. 

We have analyzed your query and tried to replicate the reported scenario at our end, but the reported scenario is not replicated at our end. Find the code snippet below to specify the culture for chart component. 

Angular: 

//Required module to load culture 
import { L10n } from '@syncfusion/ej2-base'; 
 
L10n.load({ 
    'en-GB': { 
        'chart': { 
            ZoomIn: 'ZoomIn', 
            ZoomOut: 'ZoomOut', 
            Zoom: 'Zoom', 
            Pan: 'Pan', 
            Reset: 'Reset', 
        }, 
    } 
}); 
 
<ej-chart id="chart-container" [locale]='en-GB'> 
</ej-chart> 


Screenshot: 
 

Sample for reference can be find from below link. 

If you face still any concerns, kindly revert us by modifying the attached sample or provide your sample with replication steps. This will be helpful in further analysis and provide you the solution sooner. 

Thanks, 
Dharani. 



AK Albert K November 30, 2017 12:45 AM UTC

Thanks,  How do I set the Culture of the App to en-GB ?  


DD Dharanidharan Dharmasivam Syncfusion Team November 30, 2017 10:17 AM UTC

Hi Albert. 

Thanks for the update. 

   We have analyzed your query.  You can globally specify the culture for your application using setCulture method in ej2-base. Find the code snippet below to achieve this requirement. 

Angular : 

//Required module to load setCulture 
 
import  { L10n, setCulture } from  '@syncfusion/ej2-base'; 
 
setCulture('ar-AR'); 
 
L10n.load({ 
    'ar-AR': { 
        'chart': { 
            ZoomIn: '?????', 
            ZoomOut: '?????', 
            Zoom: '???', 
            Pan: '?????', 
            Reset: '????? ?????', 
            ResetZoom: ' ???????? ?????' 
        }, 
    } 
}); 


Here you need to specify the required culture for the application in setCulture method and specify the texts with respect to the culture as shown above. And you no need to set locale property in each component. For your convenience, we have rendered two chart components and specified culture globally as stated above. 

Sample for reference can be find from below link. 

Screenshot: 
 

Kindly revert us, if you have any concenrs. 

Thanks, 
Dharani. 



AK Albert K December 1, 2017 01:14 AM UTC

Hi,

I have tried the plunker and it works.  May I know what are the language code for other languages?   I have tried "en-US" it works but "en-GB" or "en-IN" does not.


DD Dharanidharan Dharmasivam Syncfusion Team December 1, 2017 12:33 PM UTC

Hi Albert, 

Thanks for the update. 

As of now, we have provided in build support for “en-US” culture alone. Currently we are working on this localization process and will be available for any of our upcoming release 

Also we have created a sample with localization text for “ar-Ar” and “en-GB” cultures. If you need localization for other cultures, kindly use the load method to specify the corresponding locale text for zoomIn, ZoomOut, Zoom, etc as depicted  in the below code snippet and set the culture using setCulture method. 

Angular: 

import { L10n} from '@syncfusion/ej2-base'; 
 
L10n.load({ 
   'ar-AR': { 
        'chart': { 
            ZoomIn: '?????', 
            ZoomOut: '?????', 
            Zoom: '???', 
            Pan: '?????', 
            Reset: '????? ?????', 
            ResetZoom: ' ???????? ?????' 
        }, 
    }, 
    'en-GB':{ 
      'chart': { 
        zoomIn: "Zoom In", 
        zoomOut: "Zoom Out", 
        zoom: "Zoom", 
        pan: "Pan", 
        reset: "Reset" 
      } 
    }, 
     
}); 

Kindly find the sample from below location. 

Thanks, 
Dharani. 


Loader.
Up arrow icon