forked from fanruan/demo-tabledata-redis
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
629 B
22 lines
629 B
6 years ago
|
const { resolve } = require('path');
|
||
|
const { writeFileSync } = require('fs');
|
||
|
const propertiesReader = require('properties-reader');
|
||
|
|
||
|
compileZhCN2TS();
|
||
|
|
||
|
/**
|
||
|
* 转换中文的i18n,写到private里
|
||
|
*/
|
||
|
function compileZhCN2TS() {
|
||
|
let content = '';
|
||
|
|
||
|
const properties = propertiesReader(resolve(__dirname, '../../../main/resources/com/fr/plugin/db/redis/locale/redis_zh_CN.properties'));
|
||
|
properties.each((key, value) => {
|
||
|
content += ` '${key}': '${unescape(value.replace(/\\u/g, '%u'))}',\n`;
|
||
|
});
|
||
|
|
||
|
writeFileSync(resolve(__dirname, '../../private/i18n.ts'), `export const i18n = {
|
||
|
${content}};
|
||
|
`);
|
||
|
}
|