This project offers a web application which aims to facilitate locale management. With this application, you can manage keys and their related translations. Also, you can download final locale files (either *.json or *.properties) through this application.
- Download Node.js (suggestion: v5+) and MongoDB, and then get them installed.
- Start mongod process and make sure it's running normally.
Checkout this repo (or directly download the stable release from here), install dependencies, then start the web server:
$ git clone https://github.com/chejen/keys-translations-manager
$ cd keys-translations-manager
$ npm install
$ npm start
Open http://localhost:3000/ and enjoy it.
There are some settings (in ktm.config.js) you can configure. The table below lists the available ones:
Setting | Description | Default |
---|---|---|
server | Web server's hostname and port | { hostname: 'localhost', port: 3000 } |
database | MongoDB connection URI | 'mongodb://localhost:27017/translationdb' |
locales | The locales need to be managed. (You can add or remove locales arbitrarily.) | ['en-US', 'zh-TW'] |
projects | The projects need to be localized. (You can add or remove projects arbitrarily.) | [ {id:'p1', name:'project A'}, {id:'p2', name:'project B'} ] |
- Rebuild the code (
npm run build
) if you change the settings of locales or projects. - Restart the server if you change any of these configurations.
- Download locales without opening the web application. (See [keys-translations-manager-cli] 12 for more details)
/api/download/{format}/{fileType}/{projectId}/{locale}
-
Method:
- GET
-
Parameters:
format
: replace it with f (formatted) or n (not formatted) 【Required】fileType
: replace it with json or properties 【Required】projectId
: replace it with the project ID set in ktm.config.js 【Required】locale
: replace it with the locale set in ktm.config.js
Example request URIs:
-
GET http://localhost:3000/api/download/n/properties/p1
- Download a ZIP file which contains all of the locales in project p1.
-
GET http://localhost:3000/api/download/f/json/p1/en-US
- Download a JSON file for en-US locale.
- Scaffolded with [MongoDB] 1, [Express] 2, [React] 3, and [Node.js] 4
- Styled with [Bootstrap] 5 (theme: [SB Admin 2] 7) and [Less] 6
- Module Bundler: [webpack] 9
- Miscellaneous: [Babel] 10, [ESLint] 11
This source code is licensed under the MIT License.