Skip to content

base in python3, transform xlsx to iOS localizable strings file

Notifications You must be signed in to change notification settings

justinjcode/Excel2iOSString

Repository files navigation

Excel2iOSString


python3 script for converting excel into iOS/Android localization files

python3脚本,用于将excel转成iOS/安卓本地化文件

About The Project

This project is modified based on CatchZeng's project Localizable.strings2Excel. Since CatchZeng's project uses python2 and only supports the xls format (this format is outdated), it is not suitable for me to use, so I made some changes, including some logic of generating files, and the referenced libraries are different. In addition, this project currently only supports the conversion of excel to iOS files, and other types of conversion are not currently used, so they are not added. Both iOS and Android are supported now.

本项目是基于CatchZeng的项目Localizable.strings2Excel修改的。 由于CatchZeng的项目是用python2,并且只支持xls格式(该格式已经过时了),我用起来不合适,于是做了些改动,包括一些生成文件的逻辑,以及引用的库都有所不同。 另外本项目目前仅支持将excel转成iOS文件,其它类型的转换目前没用到所以没加。 已支持iOS和安卓

Getting Started

Make sure you have python3 installed on your Mac before using

使用之前,请确保您的Mac上安装了python3

Prerequisites

Installed python dependency library

安装的python依赖库

  • openpyxl
pip3 install openpyxl

Usage

  1. Terminal cd to the project

    在终端进入到项目的目录

//replace with your own directory
//替换成你自己的目录

cd /Users/xxx/Documents/Excel2iOSString
  1. run

    执行脚本

excel to iOS

python3 Xls2Strings.py -f input -t output

excel to Android

python3 Xls2Xml.py -f input -t output

Excel format

iOS:

Generally, an iOS project requires a Localizable.strings file and an InfoPlist.strings file. They correspond to a sheet in excel, and the title of the sheet is the file name. The first column is the key of the entry, and each subsequent column represents a language.

一般来说,一个iOS工程需要一个Localizable.strings文件,以及一个InfoPlist.strings文件。它们在excel对应一个sheet,sheet的标题就是文件名。 第一列是词条的key,后面每一列表示一种语言。

Excel format

results:

生成结果:

Results

Android Excel:

Excel format

Android outputs:

Results

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

justin [email protected]

Project Link: https://github.com/justinjcode/Excel2iOSString

About

base in python3, transform xlsx to iOS localizable strings file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages