前言
相信做過多國(guó)化的朋友們一定為 Localizable.strings
的翻譯工作而煩惱。先是寫出需要用到的多國(guó)化字符串虾攻,然后交由翻譯人員翻譯成各國(guó)語言楼雹,最后再把翻譯后的文檔整理寫入 Localizable.strings
。這個(gè)工作無聊琳要、反復(fù)闲礼、繁瑣牍汹,所以寫了個(gè) Localizable.strings與Excel互相轉(zhuǎn)換的工具,來提高效率柬泽。
Localizable.strings2Excel
https://github.com/CatchZeng/Localizable.strings2Excel
iOS 本地化文件(.strings
)與 Excel
互相轉(zhuǎn)換 & android 的 strings.xml
與 Excel
互相轉(zhuǎn)換 & iOS 本地化文件 轉(zhuǎn)換成 android 的 strings.xml
文件的 Python 腳本工具
特性
- 支持將 iOS strings 文件轉(zhuǎn)換成 excel 文件
- 支持將 excel 文件轉(zhuǎn)換成 iOS strings 文件
- 支持將 android xml 文件轉(zhuǎn)換成 excel 文件
- 支持將 excel 文件轉(zhuǎn)換成 android xml 文件
- 支持將 iOS strings 文件轉(zhuǎn)換成 android xml 文件
當(dāng)前版本
V1.0.0
所需環(huán)境
1.檢查 python 版本
python 版本必須是 2.x
$ python --version
Python 2.7.10
2.檢查 pip(python 包管理器)
$ pip --version
pip 19.0 from /Library/Python/2.7/site-packages/pip (python 2.7)
如果沒有安裝 pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py
3.安裝 pyexcelerator
sudo pip install pyExcelerator
4.安裝 xlrd
sudo pip install xlrd
使用說明
1.將 iOS strings 文件轉(zhuǎn)換成 excel 文件
$ 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
strings-2-xls.jpg
2.將 excel 文件轉(zhuǎn)換成 iOS strings 文件
$ python python/Xls2Strings.py -f examples/output/strings-files-to-xls_20190129_165830/ -t examples/ou
tput/
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
xls-2-strings.jpg
3.將 android xml 文件轉(zhuǎn)換成 excel 文件
$ python python/Xml2Xls.py -f examples/android/ -t examples/output
options: {'fileDir': 'examples/android/', 'targetDir': 'examples/output', 'excelStorageForm': 'multiple'}, args: []
Start converting
Convert examples/android/ successfully! you can see xls file in examples/output/xml-files-to-xls_20190129_172938
xml-2-xls.jpg
4.將 excel 文件轉(zhuǎn)換成 android xml 文件
$ python python/Xls2Xml.py -f examples/output/xml-files-to-xls_20190129_172938/ -t examples/output/
options: {'fileDir': 'examples/output/xml-files-to-xls_20190129_172938/', 'targetDir': 'examples/output/', 'excelStorageForm': 'multiple', 'additional': None}, args
: []
Start converting
Convert examples/output/xml-files-to-xls_20190129_172938/ successfully! you can xml files in examples/output//xls-files-to-xml_20190129_174207
xls-2-xml.jpg
5.將 iOS strings 文件轉(zhuǎn)換成 android xml 文件
$ 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
strings-2-xml.jpg