INI 文件转换宏的另类文本处理 - 介绍一种在某些文件中增加一行新语言字串的方法。最近,有会员需要翻译一种特殊格式的语言文件,该语言文件是文本格式,原文如下:
- EN English
- // ANALYSER:206
- EN Analysing %s - $ - press SPACE to interrupt
- // ANALYSER:227
- EN Analysis interrupted
- // ANALYSER:563
- EN Low memory, analysis is not possible
- // ANALYSER:579
- EN Module has empty code section
- // ANALYSER:599
- EN Compressed code?
- // ANALYSER:602
- EN Quick statistical test of module '%s' reports that its code section is either compressed, encrypted, or contains large amount of embedded data. Do you want to analyze this code?
- // ANALYSER:605
- EN Packed or encrypted code, code is not analysed
- .......
我们知道,使用 Passolo 本地化该文件,可以使用文本解析器来提取 EN 行中的字串,并翻译它。
但是,仅仅这样做,软件不能识别翻译字串,需要先将该文件先改造成以下格式,然后翻译 CN 行中的字串。
- EN English
- CN English
- // ANALYSER:206
- EN Analysing %s - $ - press SPACE to interrupt
- CN Analysing %s - $ - press SPACE to interrupt
- // ANALYSER:227
- EN Analysis interrupted
- CN Analysis interrupted
- // ANALYSER:563
- EN Low memory, analysis is not possible
- CN Low memory, analysis is not possible
- // ANALYSER:579
- EN Module has empty code section
- CN Module has empty code section
- // ANALYSER:599
- EN Compressed code?
- CN Compressed code?
- // ANALYSER:602
- EN Quick statistical test of module '%s' reports that its code section is either compressed, encrypted, or contains large amount of embedded data. Do you want to analyze this code?
- CN Quick statistical test of module '%s' reports that its code section is either compressed, encrypted, or contains large amount of embedded data. Do you want to analyze this code?
- // ANALYSER:605
- EN Packed or encrypted code, code is not analysed
- CN Packed or encrypted code, code is not analysed
可惜的是,Passolo 并不支持这样的处理,人工改造显然费力。那么有什么软件可以快速处理呢?
经实践,INI 文本转换宏可以轻松做到这一点。下面贴出处理方法和效果,是不是很简单?