frappe.translate._get_messages_from_page_or_report (doctype, name, module=None)
No docs
frappe.translate.add_lang_dict (code)
Extracts messages and returns Javascript code snippet to be appened at the end of the given script
Parameters:
code
- Javascript code snippet to which translations needs to be appended.frappe.translate.clear_cache ()
Clear all translation assets from :meth:frappe.cache
frappe.translate.deduplicate_messages (messages)
No docs
frappe.translate.extract_messages_from_code (code, is_py=False)
Extracts translatable srings from a code file
Parameters:
code
- code from which translatable files are to be extractedis_py
- include messages in triple quotes e.g. _('''message''')
frappe.translate.get_all_languages ()
Returns all language codes ar, ch etc
frappe.translate.get_all_messages_from_js_files (app_name=None)
Extracts all translatable strings from app .js
files
frappe.translate.get_bench_dir ()
No docs
frappe.translate.get_dict (fortype, name=None)
Returns translation dict for a type of object.
Parameters:
fortype
- must be one of doctype
, page
, report
, include
, jsfile
, boot
name
- name of the document for which assets are to be returned.frappe.translate.get_dict_from_hooks (fortype, name)
No docs
frappe.translate.get_full_dict (lang)
Load and return the entire translations dictionary for a language from :meth:frape.cache
Parameters:
lang
- Language Code, e.g. hi
frappe.translate.get_lang_dict ()
Returns all languages in dict format, full name is the key e.g. {"english":"en"}
frappe.translate.get_lang_info ()
Returns a listified version of apps/languages.txt
frappe.translate.get_lang_js (fortype, name)
Returns code snippet to be appended at the end of a JS script.
Parameters:
fortype
- Type of object, e.g. DocType
name
- Document namefrappe.translate.get_language_from_code (lang)
No docs
frappe.translate.get_messages_for_app (app)
Returns all messages (list) for a specified app
frappe.translate.get_messages_from_doctype (name)
Extract all translatable messages for a doctype. Includes labels, Python code, Javascript code, html templates
frappe.translate.get_messages_from_file (path)
Returns a list of transatable strings from a code file
Parameters:
path
- path of the code filefrappe.translate.get_messages_from_include_files (app_name=None)
Returns messages from js files included at time of boot like desk.min.js for desk and web
frappe.translate.get_messages_from_page (name)
Returns all translatable strings from a :class:frappe.core.doctype.Page
frappe.translate.get_messages_from_report (name)
Returns all translatable strings from a :class:frappe.core.doctype.Report
frappe.translate.get_server_messages (app)
Extracts all translatable strings (tagged with :func:frappe._
) from Python modules inside an app
frappe.translate.get_untranslated (lang, untranslated_file, get_all=False)
Returns all untranslated strings for a language and writes in a file
Parameters:
lang
- Language code.untranslated_file
- Output file path.get_all
- Return all strings, translated or not.frappe.translate.get_user_lang (user=None)
Set frappe.local.lang from user preferences on session beginning or resumption
frappe.translate.guess_language (lang_list=None)
Set frappe.local.lang
from HTTP headers at beginning of request
frappe.translate.is_translatable (m)
No docs
frappe.translate.load_lang (lang, apps=None)
Combine all translations from .csv
files in all apps
frappe.translate.make_dict_from_messages (messages, full_dict=None)
Returns translated messages as a dict in Language specified in frappe.local.lang
Parameters:
messages
- List of untranslated messagesfrappe.translate.pos_to_line_no (messages, code)
No docs
frappe.translate.read_csv_file (path)
Read CSV file and return as list of list
Parameters:
path
- File pathfrappe.translate.rebuild_all_translation_files ()
Rebuild all translation files: [app]/translations/[lang].csv
.
frappe.translate.rename_language (old_name, new_name)
No docs
frappe.translate.send_translations (translation_dict)
Append translated dict in frappe.local.response
frappe.translate.set_default_language (language)
Set Global default language
frappe.translate.update_translations (lang, untranslated_file, translated_file)
Update translations from a source and target file for a given language.
Parameters:
lang
- Language code (e.g. en
).untranslated_file
- File path with the messages in English.translated_file
- File path with messages in language to be updated.frappe.translate.write_csv_file (path, app_messages, lang_dict)
Write translation CSV file.
Parameters:
path
- File path, usually [app]/translations
.app_messages
- Translatable strings for this app.lang_dict
- Full translated dict.frappe.translate.write_translations_file (app, lang, full_dict=None, app_messages=None)
Write a translation file for a given language.
Parameters:
app
- app
for which translations are to be written.lang
- Language code.full_dict
- Full translated langauge dict (optional).app_messages
- Source strings (optional).