unity-i18n
Version:
i18n tool for unity game project
20 lines • 899 B
JavaScript
export function processBlanks(local) {
// 有缺陷,暂不启用
let newLocal = local.replaceAll(/(?<=\w)\{(?=\d+\})/g, ' {')
.replaceAll(/(?<=\{\d+)\}(?=\w)/g, '} ')
.replaceAll(' :', ':')
.replaceAll(/\} (?=\b(G|GB|gb|M|MB|mb|K|KB|kb|h|m|s|th)\b)/g, '}')
.replaceAll(/(?<=\\n) \{(?=\d+\})/g, '{');
// let newLocal = local.replaceAll(/(?<![\(\/>#+ ])\{(?=\d+\})/g, ' {')
// .replaceAll(/(?<=\{\d+)\}(?![\/\(\)<#%',.;!~,。;! ])/g, '} ')
// .replaceAll(' :', ':')
// .replaceAll(/\} (?=\b(G|GB|gb|M|MB|mb|K|KB|kb)\b)/g, '}');
if (newLocal.startsWith(' {') && local.startsWith('{')) {
newLocal = newLocal.substring(1);
}
if (newLocal.endsWith('} ') && local.endsWith('}')) {
newLocal = newLocal.substring(0, newLocal.length - 1);
}
return newLocal;
}
//# sourceMappingURL=ai.js.map