feat: add extractor for Module Onboarding
This commit is contained in:
parent
4a54fafa19
commit
415834809f
2 changed files with 31 additions and 0 deletions
30
frappe/gettext/extractors/module_onboarding.py
Normal file
30
frappe/gettext/extractors/module_onboarding.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import json
|
||||
|
||||
|
||||
def extract(fileobj, *args, **kwargs):
|
||||
"""
|
||||
Extract messages from Module Onboarding JSON files.
|
||||
|
||||
:param fileobj: the file-like object the messages should be extracted from
|
||||
:rtype: `iterator`
|
||||
"""
|
||||
data = json.load(fileobj)
|
||||
|
||||
if isinstance(data, list):
|
||||
return
|
||||
|
||||
if data.get("doctype") != "Module Onboarding":
|
||||
return
|
||||
|
||||
onboarding_name = data.get("name")
|
||||
|
||||
if title := data.get("title"):
|
||||
yield None, "_", title, [f"Title of the Module Onboarding '{onboarding_name}'"]
|
||||
|
||||
if subtitle := data.get("subtitle"):
|
||||
yield None, "_", subtitle, [f"Subtitle of the Module Onboarding '{onboarding_name}'"]
|
||||
|
||||
if success_message := data.get("success_message"):
|
||||
yield None, "_", success_message, [
|
||||
f"Success message of the Module Onboarding '{onboarding_name}'"
|
||||
]
|
||||
|
|
@ -126,6 +126,7 @@ def generate_pot(target_app: str | None = None):
|
|||
("hooks.py", "frappe.gettext.extractors.navbar.extract"),
|
||||
("**/report/*/*.json", "frappe.gettext.extractors.report.extract"),
|
||||
("**/onboarding_step/*/*.json", "frappe.gettext.extractors.onboarding_step.extract"),
|
||||
("**/module_onboarding/*/*.json", "frappe.gettext.extractors.module_onboarding.extract"),
|
||||
]
|
||||
|
||||
for app in apps:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue