ishrek / ExcelToStrings_ObjC

Convert EXCEL to iOS/Mac .strings files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExcelToStrings_ObjC

This project demonstrates how to use a simply python script to convert a multi-language excel file to Objective-C .strings files. Lots of developers who do not use English as there native language and they may have to do some i18n jobs, receiving excel file from professional translators. This project helps to convert these kinds of excels to Objective-C .strings files in secs.

#Requirements

  • Python3
  • Openpyxl - Python package that reads and writes from xlsx
  • Translated excel files.
    • Row -> Each word item
    • Column -> Language

#Note I am not a pro python programmer, this script just works but not good enough. Please advise if you have any suggestion.

#Environment This script has been tested under Mac OS 10.10.3 with python2 and python3 installed, running py with python3.

#Usage Command definition

$ python3 filename [EnglishColumnIndex] [IgnoreRowNumber] [IgnoreColNumber]

####Example1 Only filename, deault EnglishColumnIndex would be A, dafault IgnoreRowNumbers would be 0, and default IgnoreColumnNumber would be 0

$ python3 translate.py example1.xlsx

Alt text And you wiil get output like this

$ English column index:A
$ ignore_row_number:0
$ ignore_column_number:0
$ file folder: /Users/raxcat/translation
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/Englsih.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/繁体中文.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/简体中文.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/日本語.strings
$ ...(ignored)
$ There are 42 empty cells in raw excel file

####Example2 Specifying filename, EnglishColumnIndex to B, dafault IgnoreRowNumbers would be 2, and default IgnoreColumnNumber to 1

$ python3 translate.py example2.xlsx B 2 1

Alt text

$ English column index:B
$ ignore_row_number:2
$ ignore_column_number:1
$ file folder: /Users/raxcat/translation
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/Englsih.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/繁体中文.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/简体中文.strings
$ Generating: /Users/raxcat/translation/AMCommon.xlsx-output/日本語.strings
$ ...(ignored)
$ There are 142 empty cells in raw excel file

####Result Alt text

#Feature works

  • Test compatibility for xls file. (Older excel file format)
  • Test compatibility on other OS platforms. (Only MacOSX is tested)

#Credit Project inspired by @SplendetWang's python script.

About

Convert EXCEL to iOS/Mac .strings files.

License:MIT License


Languages

Language:Python 100.0%