Hina-softwareEngineer / python_translate_file

It reads a javascript file strings and then translated to desired language which is to be save in another file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Translating JS file strings to another language using Google Translator api 🔥 🔥

What it do:

# en.js file
export default {
  name_error: "Name is required",
};

Output :
# ur.js file
export default {
    name_error : "نام مطلوب ہے",
}
  1. This python script reads key and values from 'en.js' .
  2. Then converted the strings to desired language using google translator api
    result = Translation("en.js", "ur","en")

  1. The converted strings write in to 'ur.js' file
    WritingTranslationToOtherFile("ur.js")

Too many requests to translator api will block your IP for one day (Google has a translate API that costs money to use so they want to stop free usage from other apis). Better to use in Jupyter Notebook or any or use VPN.

That's it. 😃😃

About

It reads a javascript file strings and then translated to desired language which is to be save in another file.


Languages

Language:Python 79.4%Language:JavaScript 20.6%