Merge pull request #24280 from barredterra/translatable-string-description
fix: improve translatable string description
This commit is contained in:
commit
d549d9f637
3 changed files with 1997 additions and 2294 deletions
|
|
@ -22,12 +22,18 @@ def extract(fileobj, *args, **kwargs):
|
|||
|
||||
for field in fields:
|
||||
fieldtype = field.get("fieldtype")
|
||||
label = field.get("label")
|
||||
|
||||
if label := field.get("label"):
|
||||
if label:
|
||||
messages.append((label, f"Label of a {fieldtype} field in DocType '{doctype}'"))
|
||||
_label = label
|
||||
else:
|
||||
_label = field.get("fieldname")
|
||||
|
||||
if description := field.get("description"):
|
||||
messages.append((description, f"Description of a {fieldtype} field in DocType '{doctype}'"))
|
||||
messages.append(
|
||||
(description, f"Description of the '{_label}' ({fieldtype}) field in DocType '{doctype}'")
|
||||
)
|
||||
|
||||
if message := field.get("options"):
|
||||
if fieldtype == "Select":
|
||||
|
|
@ -37,10 +43,16 @@ def extract(fileobj, *args, **kwargs):
|
|||
continue
|
||||
|
||||
messages.extend(
|
||||
(option, f"Option for a Select field in DocType '{doctype}'") for option in select_options
|
||||
(
|
||||
option,
|
||||
f"Option for the '{_label}' ({fieldtype}) field in DocType '{doctype}'",
|
||||
)
|
||||
for option in select_options
|
||||
)
|
||||
elif fieldtype == "HTML":
|
||||
messages.append((message, f"Content of an HTML field in DocType '{doctype}'"))
|
||||
messages.append(
|
||||
(message, f"Content of the '{_label}' ({fieldtype}) field in DocType '{doctype}'")
|
||||
)
|
||||
|
||||
for link in links:
|
||||
if group := link.get("group"):
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ def generate_pot(target_app: str | None = None):
|
|||
|
||||
for app in apps:
|
||||
app_path = frappe.get_pymodule_path(app)
|
||||
catalog = get_catalog(app)
|
||||
catalog = new_catalog(app)
|
||||
|
||||
# Each file will only be processed by the first method that matches,
|
||||
# so more specific methods should come first.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue