Easily convert your .arb files to .xlsx and vice versa with these two Python scripts.
Before running the scripts, make sure you have installed the following libraries:
- Python 3.x
- os
- csv
- json
- collections
- Tkinter library (pre-installed in most Python installations)
- pandas
- openpyxl
- PIL
You can install the libraries by running the following command in your terminal:
pip install os csv json collections tkinter pandas openpyxl pillow
# or
pip3 install os csv json collections tkinter pandas openpyxl pillow
This script helps you generate a translation file in .xlsx format from multiple .arb files in a project folder
Here is the example:
Arb to Excel |
---|
python arb_to_excel.py
# or
python3 arb_to_excel.py
This script contains functions to select the root of project folder, parse the ARB files, and generate Excel file. The following steps are performed:
- Select the project folder
- Extract the path of the project folder
- Create a list of all .arb files in the "/lib/l10n" folder
- Parse the contents of the "intl_en.arb" file as a JSON objectt
- Parse the contents of the remaining .arb files as JSON objects and append them to the data dictionary
- Convert the .arb files to an Excel file and save it in the "/lib/l10n" folder
This script helps you generate multiple .arb files from an excel file. If a value doesn't exist, the corresponding key-value pair will not be present in the .arb file.
Here is the example:
Excel to Arb |
---|
python excel_to_arb.py
# or
python3 excel_to_arb.py
This script contains functions to select the excel file, select destination folder where .arb files will be saved. The steps taken by the script are:
- Select the .xlsx file
- Select the destination folder where .arb files will be sabed
- Convert the excel file to a CSV file and then to a dictionary
- Generate .arb files for different languages using the dictionary