如何获得YUI 3或AlloyUI组件的本地化版本? [英] How can I get a localized version of a YUI 3 or AlloyUI component?

查看:89
本文介绍了如何获得YUI 3或AlloyUI组件的本地化版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为示例,我如何渲染用日语而不是英语显示的AlloyUI调度程序?

As an example, how could I render an AlloyUI scheduler which has the days in Japanese rather than English?

推荐答案

To要访问YUI 3组件的本地化版本,必须使用YUI配置对象的 lang 属性。指定YUI沙箱时,向其传递您希望组件本地化的语言代码:

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...

以下是AlloyUI调度程序的一个特定示例:

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()]
    });
});

您可能还需要自己国际化组件的 strings 属性,例如, Scheduler 具有许多未更改 YUI lang 属性的国际化字符串。如果要完全国际化它,您需要翻译每个字符串

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.

有关更多信息,请参见 YUI国际化文档(特别是请求首选语言部分)。

For more information see the YUI Internationalization documentation (specifically the Requesting Preferred Languages section).

这篇关于如何获得YUI 3或AlloyUI组件的本地化版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆