|
|
@@ -808,7 +808,7 @@ def write_csv_file(path, app_messages, lang_dict): |
|
|
|
w.writerow([message, translated_string, context]) |
|
|
|
|
|
|
|
|
|
|
|
def get_untranslated(lang, untranslated_file, get_all=False): |
|
|
|
def get_untranslated(lang, untranslated_file, get_all=False, app="_ALL_APPS"): |
|
|
|
"""Returns all untranslated strings for a language and writes in a file |
|
|
|
|
|
|
|
:param lang: Language code. |
|
|
@@ -816,11 +816,16 @@ def get_untranslated(lang, untranslated_file, get_all=False): |
|
|
|
:param get_all: Return all strings, translated or not.""" |
|
|
|
clear_cache() |
|
|
|
apps = frappe.get_all_apps(True) |
|
|
|
if app != "_ALL_APPS": |
|
|
|
if app not in apps: |
|
|
|
print(f"Application {app} not found!") |
|
|
|
return |
|
|
|
apps = [app] |
|
|
|
|
|
|
|
messages = [] |
|
|
|
untranslated = [] |
|
|
|
for app in apps: |
|
|
|
messages.extend(get_messages_for_app(app)) |
|
|
|
for app_name in apps: |
|
|
|
messages.extend(get_messages_for_app(app_name)) |
|
|
|
|
|
|
|
messages = deduplicate_messages(messages) |
|
|
|
|
|
|
@@ -850,7 +855,7 @@ def get_untranslated(lang, untranslated_file, get_all=False): |
|
|
|
print("all translated!") |
|
|
|
|
|
|
|
|
|
|
|
def update_translations(lang, untranslated_file, translated_file): |
|
|
|
def update_translations(lang, untranslated_file, translated_file, app="_ALL_APPS"): |
|
|
|
"""Update translations from a source and target file for a given language. |
|
|
|
|
|
|
|
:param lang: Language code (e.g. `en`). |
|
|
@@ -879,9 +884,16 @@ def update_translations(lang, untranslated_file, translated_file): |
|
|
|
translation_dict[restore_newlines(key)] = restore_newlines(value) |
|
|
|
|
|
|
|
full_dict.update(translation_dict) |
|
|
|
apps = frappe.get_all_apps(True) |
|
|
|
|
|
|
|
for app in frappe.get_all_apps(True): |
|
|
|
write_translations_file(app, lang, full_dict) |
|
|
|
if app != "_ALL_APPS": |
|
|
|
if app not in apps: |
|
|
|
print(f"Application {app} not found!") |
|
|
|
return |
|
|
|
apps = [app] |
|
|
|
|
|
|
|
for app_name in apps: |
|
|
|
write_translations_file(app_name, lang, full_dict) |
|
|
|
|
|
|
|
|
|
|
|
def import_translations(lang, path): |
|
|
|