Scal Localization

Hey guys,
first of all, thanks for a great calendar, been working on it a bit now.
Is there still development going on or is it shut down?

Been trying to get localization to work for a while but can't really manage,
what I need is some kind of set method for daynames and monthnames,
other than that it's all great. thanks!

/David

Hi jamiegrove, thanks for

Hi jamiegrove,
thanks for the quick reply,
So if I get you right I could extend the Date object of which I feed the scal as startdate, and that would act as setting locale so to speak, that actually sounds amazingly easy and nice, try it out today.

thanks / David

Localization

jamiegrove's picture

Hi, David.

Development on scal is on hold, but you ought to be able to accomplish your goal by extending the Date object like so...

Object.extend(Date.prototype, {
monthnames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
daynames: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
});

Does this work?

Still having issues with

Still having issues with getting the localization to work, added utility methods:
setDayNames: function(param) {
return Object.extend(Date.prototype, {daynames: param});
},
setMonthNames: function(param) {
return Object.extend(Date.prototype, {monthnames: param});
},

to scal.js and call the functions like this:
var monthnames = [
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
''
];
var daynames = [
'',
'',
'',
'',
'',
'',
''
];
var opencal = new scal('opencal', updateSelect, options);
opencal.setDayNames(daynames);
opencal.setMonthNames(monthnames);

Still only the monthnames get localized... any ideas anyone?

Hmm, something happened with

Hmm, something happened with my post there, but should be the months names and days names in the arrays ofc...

Realize now that this has to

Realize now that this has to do with the daynames getting mapped in an earlier stage, which leads to reloading/rebuilding the calendar. So how would I go about putting that into my setDayNames function without loosing the settings that I used for launching it in the first place? Or do I need to rewrite scal to take daynames / monthnames as an option? That, I guess, would be more convenient and useful but the set functions would be nice to have to...

Well, I better keep talking

Well, I better keep talking to myself here for a while. The methods I created didn't work very well, trying to set a new date later on will cause the calendar to fail and complain about null daynames values, so I guess the method needs to be implemented in the declaration of the first Object.extend in some way, perhaps via Options. I'm highly leaning towards that kind of solution, but sadly I suck at JavaScript and have never worked with Prototype so that's why everything goes on one babystep at the time.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options