A tool for converting between app internationalization multilingual strings.xml and Excel, supporting iOS and Android

International multilingual conversion tool

An Introduction

When the project involves multilingual internationalization, we need to translate string.xml into other languages. Generally, translation companies will need documents in excel and other formats, but this translation file is really difficult to organize. Fortunately, a master made a py The tool converts string files to excel.

There are currently two ways:

  1. Localizable.strings2Excel (download the source code, then enter the command in the terminal to run the script to convert the file)
    Author: CatchZeng, https://github.com/CatchZeng/Localizable.strings2Excel

  2. LocalizableTool (a visual tool that supports conversion between strings.xml and Excel)
    Author: ParfoisMeng, https://github.com/ParfoisMeng/LocalizableTool
    The script code of this graphical visualization tool is also from the Localizable.strings2Excel project of CatchZeng.

Scenario 1 – Localizable.strings2Excel script tool

support:

  • Convert between iOS localization files (.strings) and Excel
  • Convert between Android strings.xml and Excel
  • Convert iOS localization files (.strings) to android strings.xml files

characteristic

  • Support converting iOS strings files to excel files
  • Support converting excel files to iOS strings files
  • Support converting android xml files into excel files
  • Support converting excel files to android xml files
  • Support converting iOS strings files to android xml files

current version

V1.0.0

required environment

1. Check the python version

The 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

Instructions for use

1. Download the source code of Localizable.strings2Excel to the computer

Download address: https://github.com/CatchZeng/Localizable.strings2Excel
After downloading the source code, switch to the project directory and open the command line terminal.

2. Convert iOS strings file to excel file

python python/Strings2Xls.py -f examples/ios/ -t examples/output

Results of the:

Start converting Convert examples/ios/ successfully! you can see xls
file in examples/output/strings-files-to-xls_20190129_165830

3. Convert excel file to iOS strings file

python python/Xls2Strings.py -f examples/output/strings-files-to-xls_20190129_165830/ -t examples/output/

Results of the:

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

4. Convert android xml file to excel file

python python/Xml2Xls.py -f examples/android/ -t examples/output

Results of the
Start convertingConvert examples/ios/ successfully! you can see xls file in examples/output/strings-files-to-xls_20190129_165830

5. Convert excel file to android xml file

python python/Xls2Xml.py -f examples/output/xml-files-to-xls_20220217_101250/ -t examples/output/

Results of the:
insert image description here

6. Convert iOS strings file to android xml file

python python/Strings2Xml.py -f examples/ios/en.lproj/ -t examples/output/

Results of the:

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

Solution 2 – Localizable Tool Instructions

Android develops an international visualization tool that can strings.xmlconvert between Excel and Excel.

  1. The core Python script code comes from the Github open source project Localizable.strings2Excel , which has been modified to adapt to Python3.
  2. The visual interface is written using PyQt5 .
  3. The development of this tool is written while learning, so the internal code is very sloppy.

Download: releases


page description

App screenshot

Explanation of each identification point in the above figure:

  1. Choose Xml2Xls ( strings.xmlto Excel) or Xls2Xml (Excel to strings.xml), the default is the former.
  2. Select the source folder. If it is Xml2Xls, select the source Xml related folder path (should include folders such as values/values-en), and if it is Xls2Xml, select the source Excel related folder path (should include one or more folders).
  3. Select the target folder. If it is Xml2Xls, select the path to generate target Excel, and if it is Xls2Xml, select the path to generate target Xml.
  4. Choose Single (single file) or Multiple (multiple files) mode. In Single mode, Xml2Xls will generate a single Excel file with language as the column name, and in Multiple mode, it will generate multiple Excel files of the corresponding language; Xls2Xml corresponds to Xml2Xls, and Single mode needs to select a single Excel file with language as the column name. Multiple needs to select multiple Excel files corresponding to the language.
  5. Generated scripting language. You can use this visualizer without paying attention.
  6. Copy the script language in 5 to the clipboard. You can use this visualizer without paying attention.
  7. Perform the conversion.

in conclusion

  • The first solution has the most complete functions, supported by both iOS and Android, but it is a little more complicated to get started, you need to download the source code and enter the name and run the script in the terminal. Recommendation 1 for iOS multilingual file conversion .
  • The second is a graphical software, fool-like operation, but only supports Android string and excel mutual conversion. Recommendation 2 for Android multilingual file conversion .

Guess you like

Origin blog.csdn.net/Jackson_Wen/article/details/122978037