Giter VIP home page Giter VIP logo

catchzeng / localizable.strings2excel Goto Github PK

View Code? Open in Web Editor NEW
579.0 16.0 136.0 8.47 MB

Python command line tool for conversion between iOS strings files and excel files & between android strings.xml files and excl files. & strings files to android strings.xml files.

License: MIT License

Python 100.00%
android-strings ios-localizable xls extract-strings android-localizable-files conversion android-xml python-command python excel

localizable.strings2excel's Introduction

Localizable.strings2Excel

Python command line tool for conversion between iOS strings files and excel files & between android strings.xml files and excl files. & strings files to android strings.xml files.

中文请点击

Features

  • Support convert iOS strings files to excel files.
  • Support convert excel files to iOS strings files.
  • Support convert android xml files to excel files.
  • Support convert excel files to android xml files.
  • Support convert iOS strings files to android xml files.

Version

V1.0.0

Required

1.Check python version

python version must be 2.x.

$ python --version
Python 2.7.10

2.Check pip(python package manager)

$ pip --version
pip 19.0 from /Library/Python/2.7/site-packages/pip (python 2.7)

if pip is not installed

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
sudo python get-pip.py

3.Install pyexcelerator

sudo pip install pyExcelerator

4.Install xlrd

sudo pip install xlrd

Usage

1.Convert iOS strings files to excel files.

$ 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

2.Convert excel files to iOS strings files

$ 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

3.Convert android xml files to excel files

$ 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

4.Convert excel files to android xml files

$ 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

5.Convert iOS strings files to android xml files.

$ 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

ChangeLog

ChangeLog

Thanks

localizable.strings2excel's People

Contributors

bryant1410 avatar catchzeng avatar light-bo avatar linguinan avatar qiusuo8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

localizable.strings2excel's Issues

导出的excel不对,生成.strings文件失败

导出的excel只有一列key值
excel生成 **.strings文件失败

因为我的excel里面包含了多语言,每个语言为一列,格式如下:

keyName en zh-Hans zh-Hant es
someKey ... ... ... ...
...
...

是否可以支持:
1.生成多语言的excel
2.从多语言的excel导出为**.strings文件

ModuleNotFoundError: No module named 'Workbook'

报错在这:
ACEdeMBP:python leopard$ python Localizable.py -f ../ios/ -t ../xls/
Traceback (most recent call last):
File "Localizable.py", line 6, in
import pyExcelerator
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyExcelerator/init.py", line 12, in
from Workbook import Workbook
ModuleNotFoundError: No module named 'Workbook'

使用pip3 install Workbook下载了还是报错找不到Workbook。
ACEdeMBP:python leopard$ pip3 install Workbook
Requirement already satisfied: Workbook in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: xlutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from Workbook)
Requirement already satisfied: xlwt in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from Workbook)
Requirement already satisfied: xlrd>=0.7.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from xlutils->Workbook)

没能从搜索引擎搜索到解决办法,求助。
这里是跟python版本相关么?我的是:
Python 3.6.3

文件未找到

Traceback (most recent call last):
  File "Localizable.py", line 71, in <module>
    main()
  File "Localizable.py", line 69, in main
    startConvert(options)
  File "Localizable.py", line 46, in startConvert
    (keys, values) = LocalizableStringsFileUtil.getKeysAndValues(path)
  File "/Users/Hares/Documents/Res/Store/Third/Localizable.strings2Excel/python/LocalizableStringsFileUtil.py", line 43, in getKeysAndValues
    file = codecs.open(path, 'r', 'utf-8')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/codecs.py", line 884, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: '../ios/zh-Hans.lproj/Localizable.strings'

若是直接在你的文件打开修改 没有问题 而我直接把项目语言文件夹拉进去 覆盖后
run起来就报这错 我检查过 权限和 所有人 都是一样的 不知道什么原因 难道是编码?

针对plurals和array也无法解析

    <plurals name="wifi_tether_connected_summary">
        <item quantity="one">%1$d device connected</item>
        <item quantity="other">%1$d devices connected</item>
    </plurals>

安装 pip 时报错

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python 版本是2.7, 执行 sudo python get-pip.py 时一直报错,无法安装pip, 我怀疑 下载的get-pip.py 是 python3 的语法。

Traceback (most recent call last):
File "get-pip.py", line 24226, in
main()
File "get-pip.py", line 199, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File "/tmp/tmpX9NOZq/pip.zip/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")

SyntaxError: invalid syntax

转出来是乱码,无法识别

这个工具很好用,谢谢.免去了好多粘贴复制,,,现在有个问题是,韩语转出来是乱码的,无法识别..这个要怎么处理..

can't open file 'Localizable.py'

安装完pyexcelerator、xld组件后执行
python Localizable.py -f /Users/cc/iCloudCC/CC/iOSCode/PlanetStore/PlanetStore -t /Users/cc/Downloads/Localizables.xls

报错
python: can't open file 'Localizable.py': [Errno 2] No such file or directory

针对android string.xml中有命名空间的,解析出来就有问题

针对string.xml中含有xliff的就有错误
希望整体格式保持不变
"Activity <xliff:g id="DDDDDDDD">%1$s</xliff:g> isn\'t responding."\n\n"Do you want to close it?"

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <string name="AAAAAAA" msgid="XXXXXXX">"Activity <xliff:g id="DDDDDDDD">%1$s</xliff:g> isn\'t responding."\n\n"Do you want to close it?"</string>
  <string name="AAAAAAA" msgid="XXXXXXX">"Another <xliff:g id="BBBBBBB">%1$s</xliff:g>message</string>
</resources>

合并到一个excel里面

怎么把多语言的结果 合并到一个excel里面。比如第一个列是key,第二列是zh,第三列是en等等

转换失败

python: can't open file 'Localizable.py': [Errno 2] No such file or directory

注释和空行保留

Hi, Catch,有两个需求这个代码暂时无法满足
1.如果.strings只有英文,其他语言没有,就会导致错乱,我想让其他语言没有的话,都用英文替代。
2.我想保留翻译和空行,使.string的行数可以和excel相对应。
看你有没有办法。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.