[英]looking to translate the page to another language. localization example of total js?.Does it translate the whole page/welcome message?
// Total.js 翻译文件 // 创建时间:2014-12-18 10:32
// index.html
T80818744 : Titulok
T-52966915 : Ahoj svet!
T-1870230665 : Total.js je webový framework pre Node.js
// 重要提示:此行是手动创建的
消息:Priame čítanie
Total.js 只能翻译包含在@(TEXT TO LOCALIZE)
短语。 首先你需要定义 Total.js 委托onLocale
,它可以为每个请求设置语言:
F.onLocale = function(req) {
// req.query.*
// req.cookie('cookie_name');
// req.headers['*']
switch (req.query.langauge) {
case 'sk':
case 'cz':
case 'ru':
return req.query.langauge;
}
return 'en';
};
/resources/YOURLANGUAGE.resource
形式查找资源文件default.resource
(如果存在)的默认资源如何使用本地化创建资源文件?
我为本地化准备了很棒的实用程序,只需从 NPM 安装 Total.js 框架作为全局库: $ sudo npm install -g total.js
$ cd yourapp
$ totaljs --translate
Total.js 终端应用程序将创建translate.resource
文件。 本地化此文件并将其复制到/resources/YOURLANGUAGE.resource
并重新启动应用程序。 就这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.