translate package¶
Submodules¶
translate.translate module¶
-
class
translate.translate.Translate(key, filename)¶ Bases:
objectClass that will translate a given file from any available language to English.
- filename: String
- The file that you want to translate
- key: String
- The Google API key
-
translateCSV(language=None, writeDoc=False, outpath='', outname='')¶ Translates the source text / table using the Google Translate API. This is built on the Pandas library for easy interactive reading of excel documents.
- language: String
- The source language to translate from. This can be left blank as the Google Translate API will be able to detect the language, but to ensure the highest accuracy this parameter should be supplied. A list of all the language abbreviations can be found here: https://pythonhosted.org/translateME/
- writeDoc: Boolean
- If True this will write the document to the specified outpath and outname. Else the translated text will be returned
- outpath: String
- Absolute file path to export the translated document to
- outname: String
- Name of the file to be exported once translation is completed. No need to add the extension, that will be added programatically.
return: String, Dictionary, or File
-
translatePDF(language=None, writeDoc=False, outpath='', outname='', filetype='')¶ Translates the source text / table using the Google Translate API.
- language: String
- The source language to translate from. This can be left blank as the Google Translate API will be able to detect the language, but to ensure the highest accuracy this parameter should be supplied. A list of all the language abbreviations can be found here: https://pythonhosted.org/translateME/
- writeDoc: Boolean
- If True this will write the document to the specified outpath and outname. Else the translated text will be returned
- outpath: String
- Absolute file path to export the translated document to
- outname: String
- Name of the file to be exported once translation is completed
- filetype: String
- Type of exported file you would like (HTML preserves formatting while txt does not). Options are ‘html’, ‘txt’, or None (if you would like to work inline)
return: String or File
-
translateXL(language=None, writeDoc=False, outpath='', outname='')¶ Translates the source text / table using the Google Translate API. This is built on the Pandas library for easy interactive reading of excel documents.
- language: String
- The source language to translate from. This can be left blank as the Google Translate API will be able to detect the language, but to ensure the highest accuracy this parameter should be supplied. A list of all the language abbreviations can be found here: https://pythonhosted.org/translateME/
- writeDoc: Boolean
- If True this will write the document to the specified outpath and outname. Else the translated text will be returned
- outpath: String
- Absolute file path to export the translated document to
- outname: String
- Name of the file to be exported once translation is completed. No need to add the extension, that will be added programatically.
return: String, Dictionary, or File