Question

I am using MooTools 1.4.1 (full More) and experience a problem with inheriting

Locale.define('de-CH').inherit('de-DE', 'Date');

When I use this Locale (de-CH), and access it as follows

var myLocale = Locale.getCurrent()

myLocale.sets.Date is NOT defined, the only thing that is defined is myLocale.sets.FormValidator, but that is only because this is explicitly set and not inherited.

When validating Dates, for example, this results in an error, obviously.

So, in my eyes, I am doing something wrong or the inheriting-Mechanism of Locale has a bug.

Anyone has experience? Thanks.

Was it helpful?

Solution

You're not supposed to directly use the sets property of a locale. The sets property will only contain the sets defined on that locale. Inherited sets are only defined on the inherited locale (which you can actually see by looking at myLocale.inherits.sets, but that's not supposed to be used directly either).

Instead, using myLocale.get('Date') will return the set you need.

Using Locale.get('Date') will work as well and will always return the set of the currently active locale (set through Locale.use('de-CH')).

You can also use calls like .get('Date.months') to get a specific property.

More information can be found in MooTools' Locale documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top