<div id="top"></div>
<!-- PROJECT SHIELDS -->
<!--
*** I am using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
<!-- PROJECT LOGO -->
<br />
<div align="center">
<img src="docs/icon.png" alt="Logo" width="156" height="156" style="margin-bottom:-40px">
<h1 align="center">Mobile Strings Converter</h1>
<p align="center">
A Python package that converts Android & iOS strings files to any supported file type.
<br />
<br />
<a href="https://pypi.org/project/mobile-strings-converter/">
<img alt="PyPI version" src="https://img.shields.io/pypi/v/mobile-strings-converter" />
</a>
<a href="https://pypi.org/project/mobile-strings-converter/">
<img alt="Python versions support" src="https://img.shields.io/pypi/pyversions/mobile-strings-converter" />
</a>
<br />
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/actions/workflows/build.yaml">
<img alt="GitHub action: Build" src="https://github.com/HenestrosaDev/mobile-strings-converter/actions/workflows/build.yaml/badge.svg" />
</a>
<a href="https://codecov.io/gh/HenestrosaDev/mobile-strings-converter/">
<img alt="Codecov" src="https://codecov.io/gh/HenestrosaDev/mobile-strings-converter/branch/main/graph/badge.svg" />
</a>
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/HenestrosaDev/mobile-strings-converter" />
</a>
<br />
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/HenestrosaDev/mobile-strings-converter" />
</a>
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/HenestrosaDev/mobile-strings-converter" />
</a>
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/HenestrosaDev/mobile-strings-converter" />
</a>
<br />
<br />
<a href="https://github.com/HenestrosaDev/mobile-strings-converter/issues/new/choose">Report Bug</a> · <a href="https://github.com/HenestrosaDev/mobile-strings-converter/issues/new/choose">Request Feature</a> · <a href="https://github.com/HenestrosaDev/mobile-strings-converter/discussions">Ask Question</a>
</p>
</div>
<!-- TABLE OF CONTENTS -->
## Table of Contents
- [About the Project](#about-the-project)
- [File Types Supported](#file-types-supported)
- [Project Structure](#project-structure)
- [Built With](#built-with)
- [Release Files](#release-files)
- [Getting Started](#getting-started)
- [Script Installation](#script-installation)
- [Package Installation](#package-installation)
- [Usage](#usage)
- [Run the Program](#run-the-program)
- [Script Flags](#script-flags)
- [Using the Package in Your Project](#using-the-package-in-your-project)
- [Generate a Spreadsheet in Google Sheets](#generate-a-spreadsheet-in-google-sheets)
- [Notes](#notes)
- [Indic Languages Supported by PDF files](#indic-languages-supported-by-pdf-files)
- [Languages Not Supported by PDF files](#languages-not-supported-by-pdf-files)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)
- [Authors](#authors)
- [Acknowledgments](#acknowledgments)
- [Support](#support)
<!-- ABOUT THE PROJECT -->
## About the Project
I tried to do the whole process of converting a strings resource file into a spreadsheet in Google Sheets by hand and, even though you can do it with the option **Data > Split text to columns**,
it involves wasting your time generating the spreadsheet manually. Due to that, I decided to build a time-efficient solution, which consists on running a Python script in order to achieve that with any file type.
Moreover, not only this script can be executed on its own, it also can be installed as a package via **PyPI** (more information [here](#using-the-package-in-your-project) about how to install it).
<!-- FILE TYPES SUPPORTED -->
### File Types Supported
- Android strings format (`*.xml`)
- CSV
- Google Sheets support
- HTML
- iOS strings format (`*.strings`)
- JSON
- MD
- ODS
- PDF
- XLSX
- YAML
<!-- PROJECT STRUCTURE -->
### Project Structure
<details>
<summary>ASCII folder structure</summary>
```
│ .gitignore
│ .pre-commit-config.yaml
│ LICENSE
│ poetry.lock
│ pyproject.toml
│ README.md
│ requirements.txt
│ requirements-dev.txt
│
├───.github
│ │ CONTRIBUTING.md
│ │
│ ├───ISSUE_TEMPLATE
│ │ bug_report_template.md
│ │ feature_request_template.md
│ │
│ └───PULL_REQUEST_TEMPLATE
│ pull_request_template.md
│
├───docs
│ icon.png
│
├───src
│ ├───mobile_strings_converter
│ │ console_style.py
│ │ converter.py
│ │ __init__.py
│ │ __main__.py
│ │
│ ├───assets
│ │ └───fonts
│ │ Aakar.ttf
│ │ AnekTelugu-VariableFont_wdth,wght.ttf
│ │ DejaVuSansCondensed.ttf
│ │ Eunjin.ttf
│ │ fireflysung.ttf
│ │ gargi.ttf
│ │ Gurvetica_a8_Heavy.ttf
│ │ Latha.ttf
│ │ Waree.ttf
│ │
│ ├───controller
│ │ main_controller.py
│ │ __init__.py
│ │
│ ├───model
│ │ transcription.py
│ │ __init__.py
│ │
│ ├───utils
│ │ constants.py
│ │ i18n.py
│ │ path_helper.py
│ │ __init__.py
│ │
│ └───view
│ main_window.py
│ __init__.py
│
└───tests
│ base_tests.py
│ test_get_strings.py
│ test_to_android.py
│ test_to_csv.py
│ test_to_html.py
│ test_to_ios.py
│ test_to_json.py
│ test_to_md.py
│ test_to_ods.py
│ test_to_pdf.py
│ test_to_xlsx.py
│ test_to_yaml.py
│
└───files
├───input
│ Localizable.strings
│ strings.xml
│
├───template-with-comments
│ Localizable.strings
│ strings.csv
│ strings.html
│ strings.json
│ strings.md
│ strings.ods
│ strings.pdf
│ strings.xlsx
│ strings.xml
│ strings.yaml
│
└───template-without-comments
Localizable.strings
strings.csv
strings.html
strings.json
strings.md
strings.ods
strings.pdf
strings.xlsx
strings.xml
strings.yaml
```
</details>
<!-- BUILT WITH -->
### Built With
- [openpyxl](https://pypi.org/project/openpyxl/) to generate ODS and XLSX files.
- [gspread](https://pypi.org/project/gspread/) to generate spreadsheets in Google Sheets.
- [protobuf](https://pypi.org/project/oauth2client/) is used by `google.oauth2.credentials` to authenticate to the user's Google account in order to create the spreadsheet in Google Sheets.
- [PyYAML](https://pypi.org/project/PyYAML/) to generate YAML files.
- [arabic-reshaper](https://pypi.org/project/arabic-reshaper/) and [python-bidi](https://pypi.org/project/python-bidi/) to add arabic characters support for PDF files.
- [fpdf2](https://pypi.org/project/fpdf2/) to generate PDF files.
- [lingua-language-detector](https://pypi.org/project/lingua-language-detector/) to recognize the **value** language when writing a PDF in order to know what font to use.
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- RELEASE FILES -->
## Release Files
| File | Description | Size |
|:------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------|:--------|
| [mobile-strings-converter.zip](https://github.com/HenestrosaDev/mobile-strings-converter/releases/latest/download/mobile-strings-converter.zip) | PDF file support for almost all languages ([see exceptions](#languages-not-supported-by-pdf-files)) | 8.43 MB |
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- GETTING STARTED -->
## Getting Started
### Script Installation
1. Download the [release](#release-files) that is best suited to your needs.
2. (Optional but recommended) Create a Python virtual environment in the project root. If you're using `virtualenv`, you would run `virtualenv venv`.
3. (Optional but recommended) Activate the virtual environment:
```bash
# on Windows
. venv/Scripts/activate
# if you get the error `FullyQualifiedErrorId : UnauthorizedAccess`, run this:
Set-ExecutionPolicy Unrestricted -Scope Process
# and then . venv/Scripts/activate
# on macOS and Linux
source venv/Scripts/activate
```
4. Open the command line and run `pip install -r path/to/requirements.txt` to install the required packages to run the script.
### Package Installation
Install the PyPI package by running `pip install mobile-strings-converter`.
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- USAGE -->
## Usage
### Run the Program
For a basic usage, you can run the following command:
```
python path/to/mobile_strings_converter.py *.[SUPPORTED_FILE_TYPE] -o *.[SUPPORTED_FILE_TYPE]
```
See [Generate a Spreadsheet in Google Sheets](#generate-a-spreadsheet-in-google-sheets) to create a spreadsheet.
#### Script Flags
| Flag | Description |
|:----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `-h` or `--help` | Displays help text for the program |
| `-o` or `--output-filepath` | Specifies the filepath for storing the converted file. The file extension can be chosen from the list of supported file types mentioned [here](#about-the-project). |
| `-g` or `--google-sheets` | Followed by the name of the sheet, creates a new Google Sheets spreadsheet with the specified name. |
| `-c` or `--credentials` | Followed by the path to your `service_account.json` file is mandatory if you want to generate a spreadsheet in your Google account. |
| `-p` or `--print-comments` | The output file will include any commented strings present in the original file. |
<p align="right">(<a href="#top">back to top</a>)</p>
### Using the Package in Your Project
Once you have followed the steps of the [Getting Started](#getting-started) section, import the package and the wrapper function(s) you want to use:
```python
# Using the `get_strings` function
from mobile_strings_converter import get_strings
get_strings(
input_filepath=Path("strings.xml"),
should_print_comments=True
)
```
### Generate a Spreadsheet in Google Sheets
#### Set Up Google Account
Before going further into running the commands to do so, please note that you will have to generate a `service_account.json` file. You can do the following to get one:
1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project or select an existing project.
3. Go to the **APIs & Services** page, click on **Dashboard** and then click on **Enable APIs and Services**.
4. Search for **Google Sheets API** and enable it.
5. Go to the **Credentials** page, click on **Create credentials**, and then choose **Service account**.
6. Give your service account a name and select a role. For this purpose, you can select **Project -> Editor**.
7. Click on the **Create key** button, select the JSON format and download the `service_account.json` file.
8. Share your Google Sheets file with the email address that is specified in the **client_email** field in the `service_account.json` file.
Alternatively, you can create a `.xlsx` file and open it in Google Sheets if you do not want to go through the hassle of generating the `service_account.json` file.
Once you have generated the `service_account.json` file, you can generate a spreadsheet in Google Sheets by running the following command:
```
python path/to/mobile_strings_converter.py <*.xml | *.strings> -g <SHEET_NAME> -c path/to/service_account.json
```
If you want to generate an output file along with the spreadsheet, run this:
```
python path/to/mobile_strings_converter.py *.[SUPPORTED_FILE_TYPE -g <SHEET_NAME> -c path/to/service_account.json -o *.[SUPPORTED_FILE_TYPE]
```
#### Using the `to_google_sheets` Function in Your Project
```python
from mobile_strings_converter import to_google_sheets
to_google_sheets(
input_filepath=Path("path/to/strings-file"),
sheet_name="MyProject strings",
credentials_filepath=Path("path/to/service_account.json"),
should_print_comments=True,
)
```
<!-- NOTES -->
## Notes
### Indic Languages Supported by PDF files
- Hindi
- Marathu
- Oriya
- Tibetan
- Gujarati
- Telugu
- Tamil
- Punjabi
### Languages Not Supported by PDF files
- Bengali <sub>(not possible to print correctly using [fpdf2](https://pypi.org/project/fpdf2/))</sub>
- Dhivehi <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Kannada <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Khmer <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Lao <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Malayalam <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Meiteilon (manipuri) <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Myanmar burmese <sub>(not possible to print correctly using [fpdf2](https://pypi.org/project/fpdf2/))</sub>
- Odia (Oriya) <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub></sub>
- Sinhala <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
- Tigrinya <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- ROADMAP -->
## Roadmap
- [x] Add support for converting a file (not `.xml` or `.strings`) into a strings resource file (`.xml` or `.strings`).
- [ ] Add support for multiple `.xml`/`.strings` files input.
- [ ] Make a web version.
You can propose a new feature creating an [issue](https://github.com/HenestrosaDev/mobile-strings-converter/new/choose).
<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Please, read the [CONTRIBUTING.md](https://github.com/HenestrosaDev/mobile-strings-converter/blob/main/.github/CONTRIBUTING.md) file, where you can find more detailed information about how to contribute to the project.
<!-- LICENSE -->
## License
Distributed under the MIT License. See `LICENSE` for more information.
<!-- AUTHORS -->
## Authors
- HenestrosaDev <henestrosadev@gmail.com> (José Carlos López Henestrosa)
See also the list of [contributors](https://github.com/HenestrosaDev/mobile-strings-converter/contributors) who participated in this project.
<!-- ACKNOWLEDGMENTS -->
## Acknowledgments
I have made use of the following resources to make this project:
- [How to create a Python package](https://mathspp.com/blog/how-to-create-a-python-package-in-2022#how-to-create-a-python-package)
<!-- SUPPORT -->
## Support
Would you like to support the project? That's very kind of you! You can go to my Ko-Fi profile by clicking on the button down below.
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/henestrosadev)
<p align="right">(<a href="#top">back to top</a>)</p>
Raw data
{
"_id": null,
"home_page": "https://github.com/HenestrosaDev/mobile-strings-converter",
"name": "mobile-strings-converter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "android, strings.xml, strings, converter, csv, xlsx, yaml, html, json, ods, pdf, md, ios, Localizable.strings",
"author": "Jos\u00e9 Carlos L\u00f3pez",
"author_email": "henestrosadev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c4/47/5a512af484a01de0cf874ae27ba24fb69a5cf4468782bc6bacbe81ddce5e/mobile_strings_converter-0.1.3.tar.gz",
"platform": null,
"description": "<div id=\"top\"></div>\n\n<!-- PROJECT SHIELDS -->\n<!--\n*** I am using markdown \"reference style\" links for readability.\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\n*** See the bottom of this document for the declaration of the reference variables\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\n-->\n\n<!-- PROJECT LOGO -->\n<br />\n<div align=\"center\">\n <img src=\"docs/icon.png\" alt=\"Logo\" width=\"156\" height=\"156\" style=\"margin-bottom:-40px\">\n <h1 align=\"center\">Mobile Strings Converter</h1>\n <p align=\"center\">\n A Python package that converts Android & iOS strings files to any supported file type.\n <br />\n <br />\n <a href=\"https://pypi.org/project/mobile-strings-converter/\">\n <img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/mobile-strings-converter\" />\n </a>\n <a href=\"https://pypi.org/project/mobile-strings-converter/\">\n <img alt=\"Python versions support\" src=\"https://img.shields.io/pypi/pyversions/mobile-strings-converter\" />\n </a>\n <br />\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/actions/workflows/build.yaml\">\n <img alt=\"GitHub action: Build\" src=\"https://github.com/HenestrosaDev/mobile-strings-converter/actions/workflows/build.yaml/badge.svg\" />\n </a>\n <a href=\"https://codecov.io/gh/HenestrosaDev/mobile-strings-converter/\">\n <img alt=\"Codecov\" src=\"https://codecov.io/gh/HenestrosaDev/mobile-strings-converter/branch/main/graph/badge.svg\" />\n </a>\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/blob/main/LICENSE\">\n <img alt=\"License\" src=\"https://img.shields.io/github/license/HenestrosaDev/mobile-strings-converter\" />\n </a>\n <br />\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/graphs/contributors\">\n <img alt=\"GitHub Contributors\" src=\"https://img.shields.io/github/contributors/HenestrosaDev/mobile-strings-converter\" />\n </a>\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/issues\">\n <img alt=\"Issues\" src=\"https://img.shields.io/github/issues/HenestrosaDev/mobile-strings-converter\" />\n </a>\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/pulls\">\n <img alt=\"GitHub pull requests\" src=\"https://img.shields.io/github/issues-pr/HenestrosaDev/mobile-strings-converter\" />\n </a>\n <br />\n <br />\n <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/issues/new/choose\">Report Bug</a> \u00b7 <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/issues/new/choose\">Request Feature</a> \u00b7 <a href=\"https://github.com/HenestrosaDev/mobile-strings-converter/discussions\">Ask Question</a>\n </p>\n</div>\n\n<!-- TABLE OF CONTENTS -->\n\n## Table of Contents\n\n- [About the Project](#about-the-project)\n - [File Types Supported](#file-types-supported) \n - [Project Structure](#project-structure)\n - [Built With](#built-with)\n- [Release Files](#release-files)\n- [Getting Started](#getting-started)\n - [Script Installation](#script-installation)\n - [Package Installation](#package-installation)\n- [Usage](#usage)\n - [Run the Program](#run-the-program)\n - [Script Flags](#script-flags)\n - [Using the Package in Your Project](#using-the-package-in-your-project)\n - [Generate a Spreadsheet in Google Sheets](#generate-a-spreadsheet-in-google-sheets)\n- [Notes](#notes)\n - [Indic Languages Supported by PDF files](#indic-languages-supported-by-pdf-files)\n - [Languages Not Supported by PDF files](#languages-not-supported-by-pdf-files)\n- [Roadmap](#roadmap)\n- [Contributing](#contributing)\n- [License](#license)\n- [Authors](#authors)\n- [Acknowledgments](#acknowledgments)\n- [Support](#support)\n\n<!-- ABOUT THE PROJECT -->\n\n## About the Project\n\nI tried to do the whole process of converting a strings resource file into a spreadsheet in Google Sheets by hand and, even though you can do it with the option **Data > Split text to columns**, \nit involves wasting your time generating the spreadsheet manually. Due to that, I decided to build a time-efficient solution, which consists on running a Python script in order to achieve that with any file type.\n\nMoreover, not only this script can be executed on its own, it also can be installed as a package via **PyPI** (more information [here](#using-the-package-in-your-project) about how to install it).\n\n<!-- FILE TYPES SUPPORTED -->\n\n### File Types Supported\n\n- Android strings format (`*.xml`)\n- CSV\n- Google Sheets support\n- HTML\n- iOS strings format (`*.strings`)\n- JSON\n- MD\n- ODS\n- PDF\n- XLSX\n- YAML\n\n<!-- PROJECT STRUCTURE -->\n\n### Project Structure\n\n<details>\n <summary>ASCII folder structure</summary>\n\n```\n\u2502 .gitignore\n\u2502 .pre-commit-config.yaml\n\u2502 LICENSE\n\u2502 poetry.lock \n\u2502 pyproject.toml\n\u2502 README.md\n\u2502 requirements.txt\n\u2502 requirements-dev.txt\n\u2502\n\u251c\u2500\u2500\u2500.github\n\u2502 \u2502 CONTRIBUTING.md\n\u2502 \u2502\n\u2502 \u251c\u2500\u2500\u2500ISSUE_TEMPLATE\n\u2502 \u2502 bug_report_template.md\n\u2502 \u2502 feature_request_template.md\n\u2502 \u2502\n\u2502 \u2514\u2500\u2500\u2500PULL_REQUEST_TEMPLATE\n\u2502 pull_request_template.md\n\u2502\n\u251c\u2500\u2500\u2500docs\n\u2502 icon.png\n\u2502\n\u251c\u2500\u2500\u2500src\n\u2502 \u251c\u2500\u2500\u2500mobile_strings_converter\n\u2502 \u2502 console_style.py\n\u2502 \u2502 converter.py\n\u2502 \u2502 __init__.py\n\u2502 \u2502 __main__.py\n\u2502 \u2502\n\u2502 \u251c\u2500\u2500\u2500assets\n\u2502 \u2502 \u2514\u2500\u2500\u2500fonts\n\u2502 \u2502 Aakar.ttf\n\u2502 \u2502 AnekTelugu-VariableFont_wdth,wght.ttf\n\u2502 \u2502 DejaVuSansCondensed.ttf\n\u2502 \u2502 Eunjin.ttf\n\u2502 \u2502 fireflysung.ttf\n\u2502 \u2502 gargi.ttf\n\u2502 \u2502 Gurvetica_a8_Heavy.ttf\n\u2502 \u2502 Latha.ttf\n\u2502 \u2502 Waree.ttf\n\u2502 \u2502\n\u2502 \u251c\u2500\u2500\u2500controller\n\u2502 \u2502 main_controller.py\n\u2502 \u2502 __init__.py\n\u2502 \u2502\n\u2502 \u251c\u2500\u2500\u2500model\n\u2502 \u2502 transcription.py\n\u2502 \u2502 __init__.py\n\u2502 \u2502\n\u2502 \u251c\u2500\u2500\u2500utils\n\u2502 \u2502 constants.py\n\u2502 \u2502 i18n.py\n\u2502 \u2502 path_helper.py\n\u2502 \u2502 __init__.py\n\u2502 \u2502\n\u2502 \u2514\u2500\u2500\u2500view\n\u2502 main_window.py\n\u2502 __init__.py\n\u2502\n\u2514\u2500\u2500\u2500tests \n \u2502 base_tests.py\n \u2502 test_get_strings.py\n \u2502 test_to_android.py\n \u2502 test_to_csv.py\n \u2502 test_to_html.py\n \u2502 test_to_ios.py\n \u2502 test_to_json.py\n \u2502 test_to_md.py\n \u2502 test_to_ods.py\n \u2502 test_to_pdf.py\n \u2502 test_to_xlsx.py\n \u2502 test_to_yaml.py\n \u2502\n \u2514\u2500\u2500\u2500files\n \u251c\u2500\u2500\u2500input\n \u2502 Localizable.strings\n \u2502 strings.xml\n \u2502\n \u251c\u2500\u2500\u2500template-with-comments\n \u2502 Localizable.strings\n \u2502 strings.csv\n \u2502 strings.html\n \u2502 strings.json\n \u2502 strings.md\n \u2502 strings.ods\n \u2502 strings.pdf\n \u2502 strings.xlsx\n \u2502 strings.xml\n \u2502 strings.yaml\n \u2502\n \u2514\u2500\u2500\u2500template-without-comments\n Localizable.strings\n strings.csv\n strings.html\n strings.json\n strings.md\n strings.ods\n strings.pdf\n strings.xlsx\n strings.xml\n strings.yaml\n```\n</details>\n\n<!-- BUILT WITH -->\n\n### Built With\n\n- [openpyxl](https://pypi.org/project/openpyxl/) to generate ODS and XLSX files.\n- [gspread](https://pypi.org/project/gspread/) to generate spreadsheets in Google Sheets.\n- [protobuf](https://pypi.org/project/oauth2client/) is used by `google.oauth2.credentials` to authenticate to the user's Google account in order to create the spreadsheet in Google Sheets. \n- [PyYAML](https://pypi.org/project/PyYAML/) to generate YAML files.\n- [arabic-reshaper](https://pypi.org/project/arabic-reshaper/) and [python-bidi](https://pypi.org/project/python-bidi/) to add arabic characters support for PDF files.\n- [fpdf2](https://pypi.org/project/fpdf2/) to generate PDF files.\n- [lingua-language-detector](https://pypi.org/project/lingua-language-detector/) to recognize the **value** language when writing a PDF in order to know what font to use. \n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n\n<!-- RELEASE FILES -->\n\n## Release Files\n\n| File | Description | Size |\n|:------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------|:--------|\n| [mobile-strings-converter.zip](https://github.com/HenestrosaDev/mobile-strings-converter/releases/latest/download/mobile-strings-converter.zip) | PDF file support for almost all languages ([see exceptions](#languages-not-supported-by-pdf-files)) | 8.43 MB |\n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n\n<!-- GETTING STARTED -->\n\n## Getting Started\n\n### Script Installation\n\n1. Download the [release](#release-files) that is best suited to your needs.\n2. (Optional but recommended) Create a Python virtual environment in the project root. If you're using `virtualenv`, you would run `virtualenv venv`.\n3. (Optional but recommended) Activate the virtual environment:\n ```bash\n # on Windows\n . venv/Scripts/activate\n # if you get the error `FullyQualifiedErrorId : UnauthorizedAccess`, run this:\n Set-ExecutionPolicy Unrestricted -Scope Process\n # and then . venv/Scripts/activate\n \n # on macOS and Linux\n source venv/Scripts/activate\n ```\n4. Open the command line and run `pip install -r path/to/requirements.txt` to install the required packages to run the script.\n\n### Package Installation\n\nInstall the PyPI package by running `pip install mobile-strings-converter`.\n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n\n<!-- USAGE -->\n\n## Usage\n\n### Run the Program\n\nFor a basic usage, you can run the following command:\n\n```\npython path/to/mobile_strings_converter.py *.[SUPPORTED_FILE_TYPE] -o *.[SUPPORTED_FILE_TYPE]\n```\n\nSee [Generate a Spreadsheet in Google Sheets](#generate-a-spreadsheet-in-google-sheets) to create a spreadsheet.\n\n#### Script Flags\n\n| Flag | Description |\n|:----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-h` or `--help` | Displays help text for the program |\n| `-o` or `--output-filepath` | Specifies the filepath for storing the converted file. The file extension can be chosen from the list of supported file types mentioned [here](#about-the-project). |\n| `-g` or `--google-sheets` | Followed by the name of the sheet, creates a new Google Sheets spreadsheet with the specified name. |\n| `-c` or `--credentials` | Followed by the path to your `service_account.json` file is mandatory if you want to generate a spreadsheet in your Google account. |\n| `-p` or `--print-comments` | The output file will include any commented strings present in the original file. |\n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n\n### Using the Package in Your Project\n\nOnce you have followed the steps of the [Getting Started](#getting-started) section, import the package and the wrapper function(s) you want to use: \n```python\n# Using the `get_strings` function\nfrom mobile_strings_converter import get_strings \n\nget_strings(\n input_filepath=Path(\"strings.xml\"), \n should_print_comments=True\n)\n```\n\n### Generate a Spreadsheet in Google Sheets\n\n#### Set Up Google Account\n\nBefore going further into running the commands to do so, please note that you will have to generate a `service_account.json` file. You can do the following to get one:\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/).\n2. Create a new project or select an existing project.\n3. Go to the **APIs & Services** page, click on **Dashboard** and then click on **Enable APIs and Services**.\n4. Search for **Google Sheets API** and enable it.\n5. Go to the **Credentials** page, click on **Create credentials**, and then choose **Service account**.\n6. Give your service account a name and select a role. For this purpose, you can select **Project -> Editor**.\n7. Click on the **Create key** button, select the JSON format and download the `service_account.json` file.\n8. Share your Google Sheets file with the email address that is specified in the **client_email** field in the `service_account.json` file.\n\nAlternatively, you can create a `.xlsx` file and open it in Google Sheets if you do not want to go through the hassle of generating the `service_account.json` file.\n\nOnce you have generated the `service_account.json` file, you can generate a spreadsheet in Google Sheets by running the following command:\n```\npython path/to/mobile_strings_converter.py <*.xml | *.strings> -g <SHEET_NAME> -c path/to/service_account.json \n```\n\nIf you want to generate an output file along with the spreadsheet, run this:\n```\npython path/to/mobile_strings_converter.py *.[SUPPORTED_FILE_TYPE -g <SHEET_NAME> -c path/to/service_account.json -o *.[SUPPORTED_FILE_TYPE]\n```\n\n#### Using the `to_google_sheets` Function in Your Project\n\n```python\nfrom mobile_strings_converter import to_google_sheets\n\nto_google_sheets(\n input_filepath=Path(\"path/to/strings-file\"),\n sheet_name=\"MyProject strings\",\n credentials_filepath=Path(\"path/to/service_account.json\"),\n should_print_comments=True,\n)\n```\n\n<!-- NOTES -->\n\n## Notes\n\n### Indic Languages Supported by PDF files\n\n- Hindi\n- Marathu\n- Oriya\n- Tibetan\n- Gujarati\n- Telugu\n- Tamil\n- Punjabi\n\n### Languages Not Supported by PDF files\n\n- Bengali <sub>(not possible to print correctly using [fpdf2](https://pypi.org/project/fpdf2/))</sub>\n- Dhivehi <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Kannada <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Khmer <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Lao <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Malayalam <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Meiteilon (manipuri) <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Myanmar burmese <sub>(not possible to print correctly using [fpdf2](https://pypi.org/project/fpdf2/))</sub>\n- Odia (Oriya) <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub></sub>\n- Sinhala <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n- Tigrinya <sub>(not recognized by [lingua-language-detector](https://pypi.org/project/lingua-language-detector/))</sub>\n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n\n<!-- ROADMAP -->\n\n## Roadmap\n\n- [x] Add support for converting a file (not `.xml` or `.strings`) into a strings resource file (`.xml` or `.strings`).\n- [ ] Add support for multiple `.xml`/`.strings` files input.\n- [ ] Make a web version.\n\nYou can propose a new feature creating an [issue](https://github.com/HenestrosaDev/mobile-strings-converter/new/choose).\n\n<!-- CONTRIBUTING -->\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\nPlease, read the [CONTRIBUTING.md](https://github.com/HenestrosaDev/mobile-strings-converter/blob/main/.github/CONTRIBUTING.md) file, where you can find more detailed information about how to contribute to the project.\n\n<!-- LICENSE -->\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n<!-- AUTHORS -->\n\n## Authors\n\n- HenestrosaDev <henestrosadev@gmail.com> (Jos\u00e9 Carlos L\u00f3pez Henestrosa)\n\nSee also the list of [contributors](https://github.com/HenestrosaDev/mobile-strings-converter/contributors) who participated in this project.\n\n<!-- ACKNOWLEDGMENTS -->\n\n## Acknowledgments\n\nI have made use of the following resources to make this project:\n\n- [How to create a Python package](https://mathspp.com/blog/how-to-create-a-python-package-in-2022#how-to-create-a-python-package)\n\n<!-- SUPPORT -->\n\n## Support\n\nWould you like to support the project? That's very kind of you! You can go to my Ko-Fi profile by clicking on the button down below.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/henestrosadev)\n\n<p align=\"right\">(<a href=\"#top\">back to top</a>)</p>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Convert Android & iOS strings files to any supported file type and vice versa.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/HenestrosaDev/mobile-strings-converter",
"Repository": "https://github.com/HenestrosaDev/mobile-strings-converter"
},
"split_keywords": [
"android",
" strings.xml",
" strings",
" converter",
" csv",
" xlsx",
" yaml",
" html",
" json",
" ods",
" pdf",
" md",
" ios",
" localizable.strings"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3e5b8885078bb865ccc66494ac01d1081f9240c5d64921b28dfcbd70ef84cf21",
"md5": "acca8de14b87d069c192f5d3e5ab3792",
"sha256": "15b43c460fd1680081758a0d62e86a0d6c92ced23794267fdff8b33f523f1465"
},
"downloads": -1,
"filename": "mobile_strings_converter-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "acca8de14b87d069c192f5d3e5ab3792",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8731662,
"upload_time": "2024-05-28T16:26:11",
"upload_time_iso_8601": "2024-05-28T16:26:11.655802Z",
"url": "https://files.pythonhosted.org/packages/3e/5b/8885078bb865ccc66494ac01d1081f9240c5d64921b28dfcbd70ef84cf21/mobile_strings_converter-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c4475a512af484a01de0cf874ae27ba24fb69a5cf4468782bc6bacbe81ddce5e",
"md5": "eb1bb9591ad1d99338c296ea41f8e09d",
"sha256": "48c8548f1d5dbe8361432b81426f434c1651a16e04900e01c251be8017698fd7"
},
"downloads": -1,
"filename": "mobile_strings_converter-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "eb1bb9591ad1d99338c296ea41f8e09d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8682070,
"upload_time": "2024-05-28T16:26:14",
"upload_time_iso_8601": "2024-05-28T16:26:14.816035Z",
"url": "https://files.pythonhosted.org/packages/c4/47/5a512af484a01de0cf874ae27ba24fb69a5cf4468782bc6bacbe81ddce5e/mobile_strings_converter-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-28 16:26:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HenestrosaDev",
"github_project": "mobile-strings-converter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "arabic_reshaper",
"specs": [
[
"~=",
"3.0.0"
]
]
},
{
"name": "python-bidi",
"specs": [
[
"~=",
"0.4.2"
]
]
},
{
"name": "fpdf2",
"specs": [
[
"==",
"2.7.9"
]
]
},
{
"name": "gspread",
"specs": [
[
"==",
"6.1.2"
]
]
},
{
"name": "lingua-language-detector",
"specs": [
[
"==",
"2.0.2"
]
]
},
{
"name": "openpyxl",
"specs": [
[
"==",
"3.1.2"
]
]
},
{
"name": "protobuf",
"specs": [
[
"==",
"5.27.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "ezodf",
"specs": [
[
"==",
"0.3.2"
]
]
},
{
"name": "PyPDF2",
"specs": [
[
"==",
"3.0.1"
]
]
}
],
"lcname": "mobile-strings-converter"
}