Translate UOM Category (az, ru) + fix extras override

Add UOM Category to the translated-doctype pipeline so its values (shown
as the `category` column of UOM Conversion Factor) render in az/ru:
- force translated_doctype=1 on the DocType JSON (update_doctype.py)
- list-view subject formatter (translate_listview_subjects.js + hooks)
- 11 missing category names + override of two upstream mistranslations:
  "Force" (was a verb) and "Area" (was "region") in extras.po (az, ru)

Fix _merge_extras: babel's Catalog.__setitem__ only merges metadata for an
existing key and never overwrites the translation string, so extras could
add new msgids but never correct an existing upstream one. Force the string
so "extras wins on conflict" actually holds (this is what made the "Area"
override take effect).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ali 2026-06-16 10:08:51 +00:00
parent ac16f09f6f
commit c57de8e6fa
6 changed files with 101 additions and 0 deletions

View File

@ -62,6 +62,7 @@ doctype_list_js = {
"Role": _listview_subject_js, "Role": _listview_subject_js,
"Role Profile": _listview_subject_js, "Role Profile": _listview_subject_js,
"UOM": _listview_subject_js, "UOM": _listview_subject_js,
"UOM Category": _listview_subject_js,
"Territory": _listview_subject_js, "Territory": _listview_subject_js,
"Price List": _listview_subject_js, "Price List": _listview_subject_js,
} }

View File

@ -117,6 +117,13 @@ def _merge_extras(dest_file, extras_file):
except AttributeError: except AttributeError:
pass pass
dest[msg.id] = msg dest[msg.id] = msg
# babel's Catalog.__setitem__ only merges metadata for an existing key —
# it does NOT overwrite the translation string. Force it so extras wins
# on conflict (otherwise we can add new msgids but never correct an
# existing upstream translation).
existing = dest.get(msg.id, msg.context)
if existing is not None:
existing.string = msg.string
count += 1 count += 1
try: try:

View File

@ -208,3 +208,47 @@ msgstr "Kommunikasiya"
# === Territory === # === Territory ===
msgid "Azerbaijan" msgid "Azerbaijan"
msgstr "Azərbaycan" msgstr "Azərbaycan"
#. UOM Category names — DocType fixture data (autoname=field:category_name),
#. shown as the `category` column of UOM Conversion Factor. UOM Category gets
#. translated_doctype=1 forced via az_locale/locale/update_doctype.py.
#. "Force" and "Area" override upstream mistranslations (verb / "region").
# === UOM Category ===
msgid "Mass"
msgstr "Kütlə"
msgid "Temperature"
msgstr "Temperatur"
msgid "Magnetic Induction"
msgstr "Maqnit induksiyası"
msgid "Electric Current"
msgstr "Elektrik cərəyanı"
msgid "Electrical Charge"
msgstr "Elektrik yükü"
msgid "Frequency and Wavelength"
msgstr "Tezlik və dalğa uzunluğu"
msgid "Density"
msgstr "Sıxlıq"
msgid "Power"
msgstr "Güc"
msgid "Pressure"
msgstr "Təzyiq"
msgid "Volume"
msgstr "Həcm"
msgid "Speed"
msgstr "Sürət"
msgid "Force"
msgstr "Qüvvə"
msgid "Area"
msgstr "Sahə"

View File

@ -208,3 +208,47 @@ msgstr "Коммуникация"
# === Territory === # === Territory ===
msgid "Azerbaijan" msgid "Azerbaijan"
msgstr "Азербайджан" msgstr "Азербайджан"
#. UOM Category names — DocType fixture data (autoname=field:category_name),
#. shown as the `category` column of UOM Conversion Factor. UOM Category gets
#. translated_doctype=1 forced via az_locale/locale/update_doctype.py.
#. "Force" and "Area" override upstream mistranslations (verb / "region").
# === UOM Category ===
msgid "Mass"
msgstr "Масса"
msgid "Temperature"
msgstr "Температура"
msgid "Magnetic Induction"
msgstr "Магнитная индукция"
msgid "Electric Current"
msgstr "Электрический ток"
msgid "Electrical Charge"
msgstr "Электрический заряд"
msgid "Frequency and Wavelength"
msgstr "Частота и длина волны"
msgid "Density"
msgstr "Плотность"
msgid "Power"
msgstr "Мощность"
msgid "Pressure"
msgstr "Давление"
msgid "Volume"
msgstr "Объём"
msgid "Speed"
msgstr "Скорость"
msgid "Force"
msgstr "Сила"
msgid "Area"
msgstr "Площадь"

View File

@ -15,6 +15,10 @@ TRANSLATED_DOCTYPES = [
"erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.json", "erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.json",
"Supplier Scorecard Variable", "Supplier Scorecard Variable",
), ),
(
"erpnext/stock/doctype/uom_category/uom_category.json",
"UOM Category",
),
] ]

View File

@ -18,6 +18,7 @@ const AZ_LOCALE_SUBJECT_FIELDS = {
"Role": "name", "Role": "name",
"Role Profile": "role_profile", "Role Profile": "role_profile",
UOM: "name", UOM: "name",
"UOM Category": "name",
Territory: "name", Territory: "name",
"Price List": "name", "Price List": "name",
}; };