Package Api Documentation for potranslator¶
API Reference for the classes in potranslator.potranslator.py¶
Main module.
-
class
potranslator.potranslator.
PoTranslator
(pot_dir=None, locale_dir=None)[source]¶ Bases:
object
This is the main class of this library. This class manages all translation tasks.
Parameters: - pot_dir – string. Path to the pot directory.
- locale_dir – string. Path to the locale directory.
-
translate
(file_name, target_lang='auto', src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[source]¶ Translates the given po file in the specified target language.
Parameters: - file_name – string. Path to the filename of the file to translate.
- target_lang – string. Target language for translation.
- src_lang – string. Source language for translation.
- encoding – string. Encoding for saving the po files.
- auto_save – bool. Toggles auto save feature.
- compiled – bool. Toggles compilation to mo files.
Returns: tuple. A tuple containing the translated version of the original catalog and the status of the POFile.
-
translate_all_locale
(src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[source]¶ Translates all the po files in the found languages in the locale folder.
Parameters: - src_lang – string. Source language for translation.
- encoding – string. Encoding for saving the po files.
- auto_save – bool. Toggles auto save feature.
- compiled – bool. Toggles compilation to mo files.
Returns: Dictionary. A dictionary of po files.
-
translate_from_pot
(filename, status, target_langs, src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[source]¶ Translates the given pot file in the specified target languages.
Parameters: - filename – string. Path to the filename of the file to translate.
- target_langs – sequence of strings. Target language for translation.
- src_lang – string. Source language for translation.
- encoding – string. Encoding for saving the po files.
- auto_save – bool. Toggles auto save feature.
- compiled – bool. Toggles compilation to mo files.
Returns: Dictionary. A dictionary of po files.
-
translate_all_pot
(target_langs, src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[source]¶ Translates all the pot files in the pot folder in the specified target languages.
Parameters: - target_langs – sequence of strings. Target language for translation.
- src_lang – string. Source language for translation.
- encoding – string. Encoding for saving the po files.
- auto_save – bool. Toggles auto save feature.
- compiled – bool. Toggles compilation to mo files.
Returns: Dictionary. A dictionary of po files.