Skip to content

this project is a python script which used to translate the crater language pack into different langs using google translation

Notifications You must be signed in to change notification settings

RitoGamingPLZ/Json-Translation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Json-Translator

this project aims to translate the json content into different langs using google translation

Requirement library

-flatten_json (https://github.com/amirziai/flatten) -deep_translator (https://github.com/nidhaloff/deep-translator) install them using

  pip install json_flatten
  pip install -U deep_translator

after installation, please comment out line 47-48 in deep-translator/parent.py

# if not payload or not isinstance(payload, str) or not payload.strip() or payload.isdigit():
    # raise NotValidPayload(payload)

Why to comment out line 47-48?

bulk translate method in deep translator has 2 second delay for each phrase to prevent getting banned from overusing translation api

this project first flatten json content into a list, then all elements combine into a line string seperated by '\n' and therefore we can put multiple phrase into one api call.

However the parent.py will detect whether phrase exist illegal character such as '\n', so we nned to remove it

How to use

python json-translate.py input-filename output-filename src-lang dest-lang

About

this project is a python script which used to translate the crater language pack into different langs using google translation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages