![Logo](https://raw.githubusercontent.com/faissaloux/geranslator/main/.github/art/logo.png)
[![Test Python package](https://github.com/faissaloux/geranslator/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/faissaloux/geranslator/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/faissaloux/geranslator/branch/main/graph/badge.svg)](https://codecov.io/gh/faissaloux/geranslator) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/faissaloux/geranslator/main.svg)](https://results.pre-commit.ci/latest/github/faissaloux/geranslator/main) ![PyPI](https://img.shields.io/pypi/v/geranslator) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/geranslator) ![PyPI - Status](https://img.shields.io/pypi/status/geranslator)
# Installation
```bash
pip install geranslator
```
# Configuration
> .geranslator-config.yaml
It's gonna be created for you. 😌
```yaml
geranslator:
lang_dir: lang
lang_files_ext: json
provider: google
origin_lang: en
target_langs: [fr, ar]
```
- lang_dir: Where your translation files live.
- lang_files_ext: Your translation files extension.
- provider: Provider you want to translate your file.
- origin_lang: The origin language you already have.
- target_langs: Languages you want your file to get translated to.
> supported extensions: json, yaml, yml, po
> supported providers: google, deepl
# Usage
## CLI
```bash
geranslator
```
### Supported options
| option | short | description |
|---|---|---|
| --provider | -p | To specify provider.|
| --lang-dir | -d | To specify translation files directory.|
| --extension | -e | To specify translation files format.|
| --origin-lang | -o | To specify the origin language.|
| --target-langs | -t | To specify target languages.|
```bash
geranslator --provider=deepl --origin-lang=en --target-langs=es,pt
```
```bash
geranslator -p deepl -o en -t es,pt
```
> [!NOTE]
> Keep in mind that default values are on `.geranslator-config.yaml`
## IDE
This will use the configuration as default
```python
from geranslator import Geranslator
Geranslator().translate()
```
You can customize it using the following methods. 😃
```python
from geranslator import Geranslator
geranslator = Geranslator()
geranslator.set_provider('google')
geranslator.set_lang_dir('translation')
geranslator.set_origin_lang('en')
geranslator.set_target_lang(['ar', 'fr'])
geranslator.set_lang_files_extension('json')
geranslator.translate()
```
You can chain them too 😮
```python
from geranslator import Geranslator
Geranslator().set_provider('google').set_lang_dir('translation').set_origin_lang('en').set_target_lang(['ar', 'fr']).set_lang_files_extension('json').translate()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/faissaloux/geranslator",
"name": "geranslator",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": null,
"keywords": "translation, translation files, translate",
"author": "Faissal Wahabali",
"author_email": "fwahabali@gmail.com",
"download_url": null,
"platform": null,
"description": "![Logo](https://raw.githubusercontent.com/faissaloux/geranslator/main/.github/art/logo.png)\n\n[![Test Python package](https://github.com/faissaloux/geranslator/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/faissaloux/geranslator/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/faissaloux/geranslator/branch/main/graph/badge.svg)](https://codecov.io/gh/faissaloux/geranslator) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/faissaloux/geranslator/main.svg)](https://results.pre-commit.ci/latest/github/faissaloux/geranslator/main) ![PyPI](https://img.shields.io/pypi/v/geranslator) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/geranslator) ![PyPI - Status](https://img.shields.io/pypi/status/geranslator)\n\n# Installation\n```bash\n pip install geranslator\n```\n# Configuration\n> .geranslator-config.yaml\n\nIt's gonna be created for you. \ud83d\ude0c\n\n```yaml\ngeranslator:\n lang_dir: lang\n lang_files_ext: json\n provider: google\n origin_lang: en\n target_langs: [fr, ar]\n```\n- lang_dir: Where your translation files live.\n- lang_files_ext: Your translation files extension.\n- provider: Provider you want to translate your file.\n- origin_lang: The origin language you already have.\n- target_langs: Languages you want your file to get translated to.\n\n> supported extensions: json, yaml, yml, po\n\n> supported providers: google, deepl\n# Usage\n## CLI\n```bash\ngeranslator\n```\n### Supported options\n| option | short | description |\n|---|---|---|\n| --provider | -p | To specify provider.|\n| --lang-dir | -d | To specify translation files directory.|\n| --extension | -e | To specify translation files format.|\n| --origin-lang | -o | To specify the origin language.|\n| --target-langs | -t | To specify target languages.|\n```bash\ngeranslator --provider=deepl --origin-lang=en --target-langs=es,pt\n```\n```bash\ngeranslator -p deepl -o en -t es,pt\n```\n> [!NOTE]\n> Keep in mind that default values are on `.geranslator-config.yaml`\n## IDE\nThis will use the configuration as default\n```python\n from geranslator import Geranslator\n\n Geranslator().translate()\n```\n\nYou can customize it using the following methods. \ud83d\ude03\n```python\n from geranslator import Geranslator\n\n geranslator = Geranslator()\n geranslator.set_provider('google')\n geranslator.set_lang_dir('translation')\n geranslator.set_origin_lang('en')\n geranslator.set_target_lang(['ar', 'fr'])\n geranslator.set_lang_files_extension('json')\n geranslator.translate()\n```\nYou can chain them too \ud83d\ude2e\n```python\n from geranslator import Geranslator\n\n Geranslator().set_provider('google').set_lang_dir('translation').set_origin_lang('en').set_target_lang(['ar', 'fr']).set_lang_files_extension('json').translate()\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Translate your translation files",
"version": "1.4.3",
"project_urls": {
"Author": "https://www.faissaloux.com",
"Documentation": "https://geranslator.faissaloux.com",
"Homepage": "https://github.com/faissaloux/geranslator",
"Source": "https://github.com/faissaloux/geranslator"
},
"split_keywords": [
"translation",
" translation files",
" translate"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eed13857821be1f5ee4a246f2c10b9e735c3f03a2f539224318db1a058a8ade4",
"md5": "1c39038748ab73b7a456891b3eed9bb4",
"sha256": "4e79c3e86f7ed57f9b04a996556560a9192c2410edd902945927d3d807ad40b9"
},
"downloads": -1,
"filename": "geranslator-1.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1c39038748ab73b7a456891b3eed9bb4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 24498,
"upload_time": "2024-09-05T21:48:51",
"upload_time_iso_8601": "2024-09-05T21:48:51.881777Z",
"url": "https://files.pythonhosted.org/packages/ee/d1/3857821be1f5ee4a246f2c10b9e735c3f03a2f539224318db1a058a8ade4/geranslator-1.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-05 21:48:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "faissaloux",
"github_project": "geranslator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "geranslator"
}