jQuery UI Widgets › Forums › Editors › Calendar › Localization for Calendar
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 2 months ago.
-
Author
-
Hi,
I’ve implemented a grid with multi-lingual support and I achieved the localization in a customized way for calendar like below and it is working fine as I expected,
var mylocalizationobj = {}; var days = { names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] }; var months = { names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""] }; localizationobj.days = days; localizationobj.months = months; $("#datagrid").jqxGrid('localizestrings', mylocalizationobj);
Same way, I’ve to do the localization for generic jqxCalendar component but the demo implementation is looking different i.e.
$('#jqxCalendar').jqxCalendar({culture: 'en-US' });
Actually, the application gets the value dynamically from environmental properties file, whenever the language is changed hence I cannot create a separate .js file for culture. So, Is there a same methodology like grid for jqxCalendar?
Looking for a swift response.
Thanks,
RajHi Raj,
The difference is that the Calendar’s localization is in different files, but if you wish, you can put these files content on your page instead of loading them dynamically.
Here’s a sample file:
(function( window, undefined ) { var Globalize; if ( typeof require !== "undefined" && typeof exports !== "undefined" && typeof module !== "undefined" ) { // Assume CommonJS Globalize = require( "globalize" ); } else { // Global variable Globalize = window.Globalize; } Globalize.addCultureInfo( "ru-RU", "default", { name: "ru-RU", englishName: "Russian (Russia)", nativeName: "русский (Россия)", language: "ru", numberFormat: { ",": " ", ".": ",", negativeInfinity: "-бесконечность", positiveInfinity: "бесконечность", percent: { pattern: ["-n%","n%"], ",": " ", ".": "," }, currency: { pattern: ["-n$","n$"], ",": " ", ".": ",", symbol: "р." } }, calendars: { standard: { "/": ".", firstDay: 1, days: { names: ["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"], namesAbbr: ["Вс","Пн","Вт","Ср","Чт","Пт","Сб"], namesShort: ["Вс","Пн","Вт","Ср","Чт","Пт","Сб"] }, months: { names: ["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь",""], namesAbbr: ["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек",""] }, monthsGenitive: { names: ["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря",""], namesAbbr: ["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек",""] }, AM: null, PM: null, patterns: { d: "dd.MM.yyyy", D: "d MMMM yyyy 'г.'", t: "H:mm", T: "H:mm:ss", f: "d MMMM yyyy 'г.' H:mm", F: "d MMMM yyyy 'г.' H:mm:ss", Y: "MMMM yyyy" } } } }); }( this ));
When you set the calendar’s culture property to “ru-RU”, the Calendar’s Globalization object will look whether it has a culture with that name and if it find it, it will apply it. The code however can be placed anywhere on your page. It is important however to have it loaded.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.