当项目涉及到多语言国际化的时候,我们需要把string.xml翻译成其他国家语言,一般翻译公司会需要excel等格式文档,可是这翻译文件实在是不好整,幸好有大神做了个py工具实现 string文件转excel.
目前有两种方式:
支持:
V1.0.0
python 版本必须是 2.x
python --version
Python 2.7.10
pip --version
pip 19.0 from /Library/Python/2.7/site-packages/pip (python 2.7)
如果没有安装 pip
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
sudo python get-pip.py
sudo pip install pyExcelerator
sudo pip install xlrd
下载地址:https://github.com/CatchZeng/Localizable.strings2Excel 下载好源码后,切换到该项目目录下打开命令行终端。
python python/Strings2Xls.py -f examples/ios/ -t examples/output
执行结果:
Start converting Convert examples/ios/ successfully! you can see xls file in examples/output/strings-files-to-xls_20190129_165830
python python/Xls2Strings.py -f examples/output/strings-files-to-xls_20190129_165830/ -t examples/output/
执行结果:
options: {‘fileDir’: ‘examples/output/strings-files-to-xls_20190129_165830/’, ‘targetDir’: ‘examples/output/’, ‘excelStorageForm’: ‘multiple’, ‘additional’: None }, args: [] Start converting Convert examples/output/strings-files-to-xls_20190129_165830/ successfully! you can see strings file in examples/output//xls-files-to-strings_20190129_171146
python python/Xml2Xls.py -f examples/android/ -t examples/output
执行结果
python python/Xls2Xml.py -f examples/output/xml-files-to-xls_20220217_101250/ -t examples/output/
执行结果:
python python/Strings2Xml.py -f examples/ios/en.lproj/ -t examples/output/
执行结果:
options: {‘fileDir’: ‘examples/ios/en.lproj/’, ‘targetDir’: ‘examples/output/’, ‘additional’: None}, args: [] Creating android file:examples/output//strings-files-to-xml_20190129_164122/Localizable.xml Creating android file:examples/output//strings-files-to-xml_20190129_164122/InfoPlist.xml Convert successfully! you can see xml files in examples/output//strings-files-to-xml_20190129_164122
Android 开发国际化可视化工具,可将 strings.xml
与 Excel 互相转换。
下载:releases
上图各标识点说明:
strings.xml
转Excel) 还是 Xls2Xml(Excel转strings.xml
) ,默认为前者。发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/171964.html原文链接:https://javaforall.cn