arshaw / xdate

A Modern JavaScript Date Library
http://arshaw.com/xdate/
GNU General Public License v2.0
681 stars 81 forks source link

I18N support #9

Open c9s opened 12 years ago

c9s commented 12 years ago

Hi,

does this library support i18n ? or any way to define i18n texts?

janicki commented 12 years ago

It looks like you can pass a locale definition in toString(). Search for "January" in the source code to see an example of the JSON object format for a locale.

You could save some CPU by extending that existing array/map that only has one element for the default '' key, then you should be able to just pass the key to the toString(), rather than the whole JSON mess. (The docs hint at that... I haven't tried it.)

arshaw commented 11 years ago

above pull request #17 implements es

arshaw commented 11 years ago

@janicki, currently, you can just pass in the key (like '' or hypothetically 'es') and it will work. The method argument is settings but is overloaded to support object or string.

arshaw commented 11 years ago

@c9s, you are correct, XDate is very lacking on the i18n and it should ideally have a load of external JS files, each specifying it's own settings.

elisechant commented 4 years ago

This would be a great feature for the roadmap.