iOS Localizable.strings与Excel互相转换工具

前言

相信做过多国化的朋友们一定为 Localizable.strings 的翻译工作而烦恼。先是写出需要用到的多国化字符串,然后交由翻译人员翻译成各国语言,最后再把翻译后的文档整理写入 Localizable.strings。这个工作无聊、反复、繁琐,所以写了个 Localizable.strings与Excel互相转换的工具,来提高效率。

Localizable.strings2Excel

https://github.com/CatchZeng/Localizable.strings2Excel

iOS 本地化文件(.strings)与 Excel 互相转换 & android 的 strings.xmlExcel 互相转换 & iOS 本地化文件 转换成 android 的 strings.xml 文件的 Python 脚本工具

特性

  • 支持将 iOS strings 文件转换成 excel 文件
  • 支持将 excel 文件转换成 iOS strings 文件
  • 支持将 android xml 文件转换成 excel 文件
  • 支持将 excel 文件转换成 android xml 文件
  • 支持将 iOS strings 文件转换成 android xml 文件

当前版本

V1.0.0

所需环境

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 文件转换成 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 文件转换成 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 文件转换成 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 文件转换成 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 文件转换成 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

ChangeLog

ChangeLog

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,213评论 25 708
  • # Python 资源大全中文版 我想很多程序员应该记得 GitHub 上有一个 Awesome - XXX 系列...
    aimaile阅读 26,563评论 6 427
  • GitHub 上有一个 Awesome - XXX 系列的资源整理,资源非常丰富,涉及面非常广。awesome-p...
    若与阅读 18,740评论 4 418
  • 今天,躺的强跑来跟我聊天 :加了那么多微信群有用吗? :有用啊! :有什么用呢? :1、学习知识经验;2、交朋友;...
    彭杨森阅读 4,509评论 7 16
  • 在某一著名咖啡厅喝咖啡,结果快喝完的时候在旁边玻璃栏杆爬出一只小强,这个感觉,真的是跟刚刚喝了一杯泡有小强的咖啡,...
    小黑瓜阅读 174评论 0 0