Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/osfunapps/os_translator_xlsx-py
This module aim is to translate a string to a desired languages and save the output in a nice excel file.
https://github.com/osfunapps/os_translator_xlsx-py
Last synced: 27 days ago
JSON representation
This module aim is to translate a string to a desired languages and save the output in a nice excel file.
- Host: GitHub
- URL: https://github.com/osfunapps/os_translator_xlsx-py
- Owner: osfunapps
- License: mit
- Created: 2020-02-27T13:51:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-07T14:10:08.000Z (almost 4 years ago)
- Last Synced: 2024-11-09T14:45:57.399Z (about 2 months ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Introduction
------------This module aim is to translate a string to a desired languages and save the output in a nice excel file
## Installation
Install via pip:pip install os-translator-xlsx
## Usage
```python
import os_translator_xlsx.to_xlsx_translator as excel_translatorexcel_translator.translate_to_excel('output/path/file.xlsx',
'/path/to/service/account/.json',
'firebaseprojectId',
'en-US',
["First sentence", "Second setntence"],
['zu', 'fr'])
```
## Method signatures
```python
def translate_to_excel(excel_file_path,
service_account_json_path,
project_id,
language_initials_src,
text_list,
language_initials_list):
"""Will translate a text to a given languages and save the results in a nice excel file.Parameters:
:param excel_file_path: the path to the excel file with all of the translations
:param service_account_json_path: the path to your google translate api json key. Download from your firebase's project's settings
:param project_id: your project id (fetch from your api console project's name: https://console.cloud.google.com/?_ga=2.55756075.1423406147.1582784765-1154152733.1582784765)
:param language_initials_src: the source language
:param text_list: a list containing all of the texts to translate
:param language_initials_list: the initials of the languages you want to translate toNOTICE:
If there are substrings you don't want to translate, write KEEP before them. Example: "The boy looks KEEPWord".
Also, you can use this bank of languages:
['en-GB', 'af', 'am', 'ar', 'hy-AM', 'az-AZ', 'bn-BD', 'eu-ES', 'be', 'bg', 'my-MM', 'ca', 'zh-HK', 'zh-CN', 'zh-TW', 'hr', 'cs-CZ', 'da-DK', 'nl-NL', 'en-AU', 'en-IN', 'en-SG', 'en-ZA', 'en-CA', 'en-US', 'et', 'fil', 'fi-FI', 'fr-FR', 'fr-CA', 'gl-ES', 'ka-GE', 'de-DE', 'el-GR', 'hi-IN', 'hu-HU', 'is-IS', 'id', 'it-IT', 'ja-JP', 'kn-IN', 'km-KH', 'ko-KR', 'ky-KG', 'lo-LA', 'lv', 'lt', 'mk-MK', 'ms', 'ml-IN', 'mr-IN', 'mn-MN', 'ne-NP', 'no-NO', 'fa', 'pl-PL', 'pt-BR',
'pt-PT', 'ro', 'ro', 'ru-RU', 'sr', 'si-LK', 'sk', 'sl', 'es-419', 'es-ES', 'es-US', 'sw', 'sv-SE', 'ta-IN', 'te-IN', 'th', 'tr-TR', 'uk', 'vi', 'zu']
"""
```
## Licence
MIT