i18next在客户端实现站点的本地化,i18next从服务端获取资源然后对标签为data-i18n 的内容进行翻译。
示例:
// given loaded and merged dictionaries in i18next.js to:{ "en_US": { "ns.special": { "app": { "name": "i18n", "insert": "you are __youAre__", "child": "__count__ child", "child_plural": "__count__ children" } }, "ns.common": {} }, "en": { "ns.special": { "app": { "area": "Area 51" } }, "ns.common": {} }, "dev": { "ns.common": { "app": { "company": { "name": "my company" } }, "add": "add" }, "ns.special": { "nav": { "1": "link1", "2": "link2", "home": "home" } } }}
评论