README
kol-locale-middleware
将国际化文案按照不同的环境添加到handlebars模板中:
- development:将对应的国际化文案直接添加到handlebars中
- production:将对应的国际化文案以js的方式引入到handlebars中
Getting Started
To begin, you'll need to install kol-locale-middleware
:
first, you need to add dependencies
like this:
{
"dependencies": {
"@noxfed/kol-locale-middleware": "git+http://10.8.1.200:88/NoxFED/kol-locale-middleware.git"
}
}
second, use npm install all packages
$ npm install
Then add the loader to your express
config. For example:
server.js
const express = require("express");
const app = express();
app.use(
require("@noxfed/express-manifest")({
file: {}
locale: "locale",
mount: "LANG_SCRIPT",
})
);
Options
所有属性均为必填项
Name | Type | Default | Description |
---|---|---|---|
file |
Object |
null |
国际化数据对象 |
locale |
String |
null |
当前语言获取位置 |
mount |
String |
null |
模板数据挂载位置 |
locale、mount均为express中res
下的位置