- Home
- Forum
- ASP.NET Core - EJ 2
- Internationanalization
Internationanalization
Hello
NET CORE MVC EXAMPLE~
I'm using your ej2-locale-master...
Best regards
Pedro Alegria
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
JC
Joseph Christ Nithin Issack
Syncfusion Team
March 30, 2021 07:03 AM UTC
Hello Pedro,
Greetings from Syncfusion support.
We have checked your query. Please find the attached sample for the application example for using ejs-calendar using titles and messages in Portuguese language.
Regards,
Joseph Christ Nithin I
PA
pedro alegria
March 30, 2021 10:58 AM UTC
Thank you very much for your help! For calendar now is working !
Is there a simple way to translate all syncfusion components, localization and internationalization, to pt ?
My application must work in "pt" and "en".
Does I have to insert the script that was sent in your sample, on all pages and for all components ?
Best regards,
P.A
JC
Joseph Christ Nithin Issack
Syncfusion Team
March 31, 2021 09:20 PM UTC
Hello Pedro,
Thanks for the update.
We have checked your query. You can add the L10n configurations script in the body tag of the ‘_Layout.cshtml’ file. The below code snippet is an example of the L10n configurations script for the calendar and the datepicker components in Portuguese language.
|
<script>
document.addEventListener('DOMContentLoaded', function () {
var L10n = ej.base.L10n;
L10n.load({
"pt": {
"calendar": {
"today": "Hoje"
},
"datepicker": {
"today": "Hoje",
"placeholder": "Escolha uma data"
},
}
});
loadCultureFiles('pt');
});
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json', 'currencies.json'];
if (name === 'ar') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'ar' && prop === files.length - 1) {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../cldr-data/main/' + name + '/' + files[prop], 'GET', false);
}
ajax.onSuccess = function (value) {
val = value;
};
ajax.send();
loader(JSON.parse(val));
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
</script>
|
Note: Click the below link for L10n Configurations
Then you have to get the instance of the components and set the locale to your preferred language. The below code snippet is an example of the Calendar and the DatePicker components.
|
<ejs-calendar id="calendar"></ejs-calendar>
<ejs-datepicker id="datepicker"></ejs-datepicker>
<script>
document.addEventListener('DOMContentLoaded', function () {
calendarObject = document.getElementById('calendar').ej2_instances[0];
datepickerObject = document.getElementById('datepicker').ej2_instances[0];
calendarObject.locale = 'pt';
datepickerObject.locale = 'pt';
});
</script>
|
I have also attached a sample for the above query. Kindly revert for more queries.
Regards,
Joseph Christ Nithin I
Marked as answer
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
PA pedro alegria
- Mar 27, 2021 07:36 PM UTC
- Mar 31, 2021 09:20 PM UTC