As an example, how could I render an AlloyUI scheduler which has the days in Japanese rather than English?
To access a localized version of a YUI 3 component you must use the YUI config object's lang
property. When specifying a YUI sandbox, pass it the language code(s) which you want the component(s) to be localized for:
YUI({ lang : 'ja-JP' }).use( // your code here...
Here is a specific example with the AlloyUI scheduler:
YUI({ lang : 'ja-JP' }).use('aui-scheduler', function(Y) {
new Y.Scheduler({
boundingBox: '#myScheduler',
items: [],
render: true,
views: [new Y.SchedulerWeekView()]
});
});
You may also need to internationalize the strings
attribute of your components yourself. For example, the Scheduler
has many strings that are not internationalized by changing the YUI
lang
attribute. If you want to fully internationalize it, you'll need to translate each string.
For more information see the YUI Internationalization documentation (specifically the Requesting Preferred Languages section).