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
659 B
22 lines
659 B
6 years ago
|
const { resolve } = require('path');
|
||
|
const { writeFileSync } = require('fs');
|
||
|
const propertiesReader = require('properties-reader');
|
||
|
|
||
|
let content = '';
|
||
|
|
||
|
const properties = propertiesReader(resolve(__dirname, '../../i18n/zh_cn.properties'));
|
||
|
function toUnicodeFun(data) {
|
||
|
if (data === '' || typeof data === 'undefined') return '';
|
||
|
let str = '';
|
||
|
for (let i = 0; i < data.length; i++) {
|
||
|
str += `\\u${data.charCodeAt(i).toString(16)}`;
|
||
|
}
|
||
|
|
||
|
return str;
|
||
|
}
|
||
|
properties.each((key, value) => {
|
||
|
content += `${key}= ${toUnicodeFun(value)}\n`;
|
||
|
});
|
||
|
|
||
|
writeFileSync(resolve(__dirname, '../../i18n/zh_cn_unicode.properties'), `${content}`);
|