Reputation: 1
// Total.js translation file // Created: 2014-12-18 10:32
// index.html
T80818744 : Titulok
T-52966915 : Ahoj svet!
T-1870230665 : Total.js je webový framework pre Node.js
// IMPORTANT: This line was created manually
message : Priame čítanie
Upvotes: 0
Views: 165
Reputation: 748
Total.js can translate only phrases wrapped in @(TEXT TO LOCALIZE)
. First you need to define Total.js delegate onLocale
which can set the language for each request:
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
(if exists)How to create a resource file with localization?
I have prepared great utilites for localization, just install Total.js framework as a global library from NPM: $ sudo npm install -g total.js
$ cd yourapp
$ totaljs --translate
Total.js terminal app will create translate.resource
file. Localize this file and copy it to /resources/YOURLANGUAGE.resource
and restart app. That's all.
Upvotes: 1