HiTask开发笔记 - based on Meteor & WeKan

  1. Ubuntu64位启动WeKan失败,报错:
    t9n.coffee:71 Uncaught Error: language zh does not exist
    原因:首先要搞明白什么是T9N和I18N,
    Translation (T9N) consists in converting one text into another language.
    Internationalization (I18N) consists in adapting the product and its design so that it is easy to localize

在t9n.coffee中,setLanguage其实只需要出现一次,当然出错的原因不是因为出现了两次,而是Meteor找不到包含T9N的语言文件。
因此,解决办法有两个:
A.(不推荐)

if (language) {
TAPi18n.setLanguage(language);
// XXX
//const shortLanguage = language.split('-')[0];
//T9n.setLanguage(shortLanguage);
}

B.

  1. meteor add softwarerero:accounts-t9n.
  2. 注意原代码是有bug的,原因是作者将“-”变为了“_”,作者已经fix(详见refer),但是问题仍旧得去掉split,否则中文页面是无法显示的
// XXX
// const shortLanguage = language.split('-')[0];
shortLanguage = 'zh_cn';  // TEST OK
T9n.setLanguage(shortLanguage);

所以标准改法应为:
const shortLanguage = language.replace("-", "_").toLowerCase();
Refer:
http://www.whp.net/en/l10n-t9n-i18n-or-g11n-a-new-language/
https://github.com/softwarerero/meteor-accounts-t9n/pull/100

你可能感兴趣的:(HiTask开发笔记 - based on Meteor & WeKan)