diff --git a/core/config.coffee b/core/config.coffee index 31315fa..6619b33 100644 --- a/core/config.coffee +++ b/core/config.coffee @@ -17,6 +17,9 @@ module.exports = 'linux', 'nodejs', 'php', 'python', 'rootpanel' ] + plugin: + availablePlugin: ['shadowsocks'] + plans: all: t_name: '所有服务(默认)' diff --git a/core/i18n.coffee b/core/i18n.coffee index fbbcc44..b685e8e 100644 --- a/core/i18n.coffee +++ b/core/i18n.coffee @@ -13,6 +13,10 @@ exports.load = (path) -> for lang in options.available_language data[lang] = JSON.parse fs.readFileSync((require 'path').join(path, "#{lang}.json"), 'utf8') +exports.loadPlugin = (path, name) -> + for lang in options.available_language + data[lang]['plugins'][name] = JSON.parse fs.readFileSync((require 'path').join(path, "#{lang}.json"), 'utf8') + exports.translate = (name, lang) -> unless lang lang = options.default_language diff --git a/core/index.coffee b/core/index.coffee index a6fd721..7dd87ca 100644 --- a/core/index.coffee +++ b/core/index.coffee @@ -62,6 +62,9 @@ exports.runWebServer = -> api = require './api' api.bind app + plugin = require './plugin' + plugin.loadPlugins() + app.listen config.web.port unless module.parent diff --git a/core/plugin.coffee b/core/plugin.coffee new file mode 100644 index 0000000..664e562 --- /dev/null +++ b/core/plugin.coffee @@ -0,0 +1,8 @@ +path = require 'path' + +i18n = require './i18n' +config = require './config' + +exports.loadPlugins = -> + for name in config.plugin.availablePlugin + i18n.loadPlugin path.join(__dirname, "../plugin/#{name}/locale"), name diff --git a/plugin/shadowsocks/locale/zh_CN.json b/plugin/shadowsocks/locale/zh_CN.json new file mode 100644 index 0000000..05c7a64 --- /dev/null +++ b/plugin/shadowsocks/locale/zh_CN.json @@ -0,0 +1,3 @@ +{ + "name": "ShadowSocks" +}