set langs to config and modify gulp build to support langs
This commit is contained in:
31
Gulpfile.js
31
Gulpfile.js
@ -15,6 +15,8 @@ var base = leanoteBase + '/public'; // public base
|
|||||||
var noteDev = leanoteBase + '/app/views/note/note-dev.html';
|
var noteDev = leanoteBase + '/app/views/note/note-dev.html';
|
||||||
var noteProBase = leanoteBase + '/app/views/note';
|
var noteProBase = leanoteBase + '/app/views/note';
|
||||||
|
|
||||||
|
var confFile = './conf/app.conf';
|
||||||
|
|
||||||
// 合并Js, 这些js都是不怎么修改, 且是依赖
|
// 合并Js, 这些js都是不怎么修改, 且是依赖
|
||||||
// 840kb, 非常耗时!!
|
// 840kb, 非常耗时!!
|
||||||
gulp.task('concatDepJs', function() {
|
gulp.task('concatDepJs', function() {
|
||||||
@ -265,20 +267,21 @@ gulp.task('i18n', function() {
|
|||||||
fs.writeFile(base + '/js/i18n/' + toFilename, str);
|
fs.writeFile(base + '/js/i18n/' + toFilename, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 必须要的
|
// get all langs
|
||||||
// keys.push();
|
/**
|
||||||
|
* i18n.languages=en-us,zh-cn,zh-hk,pt-pt,fr-fr
|
||||||
genI18nJsFile('blog.zh-cn', [], keys);
|
*/
|
||||||
genI18nJsFile('blog.zh-hk', [], keys);
|
var langs = ['zh-cn', 'zh-hk', 'en-us', 'fr-fr', 'pt-pt'];
|
||||||
genI18nJsFile('blog.en-us', [], keys);
|
var config = fs.readFileSync(confFile, 'utf-8');
|
||||||
genI18nJsFile('blog.fr-fr', [], keys);
|
var langMatch = confFile.match(/i18n.languages=(.*)/);
|
||||||
genI18nJsFile('blog.pt-pt', [], keys);
|
if (langMatch) {
|
||||||
|
langs = langMatch[1].replace(/ /g, '').split(',');
|
||||||
genI18nJsFile('msg.fr-fr', ['member.fr-fr', 'markdown.fr-fr', 'album.fr-fr'], keys);
|
}
|
||||||
genI18nJsFile('msg.zh-cn', ['member.zh-cn', 'markdown.zh-cn', 'album.zh-cn'], keys);
|
for (var i = 0; i < langs.length; ++i) {
|
||||||
genI18nJsFile('msg.zh-hk', ['member.zh-hk', 'markdown.zh-hk', 'album.zh-hk'], keys);
|
var lang = langs[i];
|
||||||
genI18nJsFile('msg.en-us', ['member.en-us', 'markdown.en-us', 'album.en-us'], keys);
|
genI18nJsFile('blog.' + lang, [], keys);
|
||||||
genI18nJsFile('msg.pt-pt', ['member.pt-pt', 'markdown.pt-pt', 'album.pt-pt'], keys);
|
genI18nJsFile('msg.' + lang, ['member.' + lang, 'markdown.' + lang, 'album.' + lang], keys);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 合并album需要的js
|
// 合并album需要的js
|
||||||
|
@ -45,6 +45,8 @@ log.error.prefix = "ERROR "
|
|||||||
|
|
||||||
# The default language of this application.
|
# The default language of this application.
|
||||||
i18n.default_language=en-us
|
i18n.default_language=en-us
|
||||||
|
# All supported languages
|
||||||
|
i18n.languages=en-us,zh-cn,zh-hk,pt-pt,fr-fr
|
||||||
|
|
||||||
module.static=github.com/revel/modules/static
|
module.static=github.com/revel/modules/static
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ db.password= # if not exists, please leave it blank
|
|||||||
# or you can set the mongodb url for more complex needs the format is:
|
# or you can set the mongodb url for more complex needs the format is:
|
||||||
# mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
|
# mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
|
||||||
# db.url=mongodb://root:root123@localhost:27017/leanote
|
# db.url=mongodb://root:root123@localhost:27017/leanote
|
||||||
# db.urlEnv=${MONGODB_URL} # set url from env. eg. mongodb://root:root123@localhost:27017/leanote
|
# db.urlEnv=${MONGODB_URL} # set url from env. eg.
|
||||||
|
# mongodb://root:root123@localhost:27017/leanote
|
||||||
|
|
||||||
# You Must Change It !! About Security!!
|
# You Must Change It !! About Security!!
|
||||||
app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y
|
app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y
|
||||||
@ -45,6 +46,8 @@ log.error.prefix = "ERROR "
|
|||||||
|
|
||||||
# The default language of this application.
|
# The default language of this application.
|
||||||
i18n.default_language=en-us
|
i18n.default_language=en-us
|
||||||
|
# All supported languages
|
||||||
|
i18n.languages=en-us,zh-cn,zh-hk,pt-pt,fr-fr
|
||||||
|
|
||||||
module.static=github.com/revel/modules/static
|
module.static=github.com/revel/modules/static
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user