From af0ae930ca0eb0bad2509797e54db76fe62c0339 Mon Sep 17 00:00:00 2001
From: barredterra <14891507+barredterra@users.noreply.github.com>
Date: Fri, 16 Aug 2024 21:38:56 +0200
Subject: [PATCH] fix: translatability of boldened text
---
erpnext/accounts/doctype/account/account.py | 2 +-
.../doctype/pos_closing_entry/pos_closing_entry.py | 10 +++-------
erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 2 +-
.../pos_invoice_merge_log/pos_invoice_merge_log.py | 11 +++++------
.../accounts/doctype/pricing_rule/pricing_rule.py | 5 +++--
.../doctype/purchase_invoice/purchase_invoice.py | 12 ++++++------
.../accounts/doctype/sales_invoice/sales_invoice.py | 6 +++---
.../tax_withholding_details.py | 2 +-
erpnext/assets/doctype/asset/asset.py | 2 +-
erpnext/controllers/accounts_controller.py | 12 +++++++-----
erpnext/controllers/item_variant.py | 2 +-
erpnext/controllers/selling_controller.py | 2 +-
.../doctype/plaid_settings/plaid_settings.py | 2 +-
erpnext/setup/doctype/company/company.py | 6 +++---
erpnext/stock/doctype/batch/batch.py | 4 ++--
erpnext/stock/doctype/stock_entry/stock_entry.py | 6 +++---
.../stock_reservation_entry.py | 5 +++--
.../stock/doctype/stock_settings/stock_settings.py | 8 ++++----
.../service_level_agreement.py | 2 +-
19 files changed, 50 insertions(+), 51 deletions(-)
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index db95d6c87eb0..180edc61ced6 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -200,7 +200,7 @@ def validate_receivable_payable_account_type(self):
msg = _(
"There are ledger entries against this account. Changing {0} to non-{1} in live system will cause incorrect output in 'Accounts {2}' report"
).format(
- frappe.bold("Account Type"), doc_before_save.account_type, doc_before_save.account_type
+ frappe.bold(_("Account Type")), doc_before_save.account_type, doc_before_save.account_type
)
frappe.msgprint(msg)
self.add_comment("Comment", msg)
diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
index 9faf8693a8a5..fda868cfe513 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
+++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
@@ -87,19 +87,15 @@ def validate_pos_invoices(self):
as_dict=1,
)[0]
if pos_invoice.consolidated_invoice:
- invalid_row.setdefault("msg", []).append(
- _("POS Invoice is {}").format(frappe.bold("already consolidated"))
- )
+ invalid_row.setdefault("msg", []).append(_("POS Invoice is already consolidated"))
invalid_rows.append(invalid_row)
continue
if pos_invoice.pos_profile != self.pos_profile:
invalid_row.setdefault("msg", []).append(
- _("POS Profile doesn't matches {}").format(frappe.bold(self.pos_profile))
+ _("POS Profile doesn't match {}").format(frappe.bold(self.pos_profile))
)
if pos_invoice.docstatus != 1:
- invalid_row.setdefault("msg", []).append(
- _("POS Invoice is not {}").format(frappe.bold("submitted"))
- )
+ invalid_row.setdefault("msg", []).append(_("POS Invoice is not submitted"))
if pos_invoice.owner != self.user:
invalid_row.setdefault("msg", []).append(
_("POS Invoice isn't created by user {}").format(frappe.bold(self.owner))
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index dc3f95e553bd..40c99bd07a6f 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -188,7 +188,7 @@ def __init__(self, *args, **kwargs):
def validate(self):
if not cint(self.is_pos):
frappe.throw(
- _("POS Invoice should have {} field checked.").format(frappe.bold("Include Payment"))
+ _("POS Invoice should have the field {0} checked.").format(frappe.bold(_("Include Payment")))
)
# run on validate method of selling controller
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
index 24b9c105ae76..c830b4e9c2c4 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
@@ -97,16 +97,15 @@ def validate_pos_invoice_status(self):
return_against_status = frappe.db.get_value("POS Invoice", return_against, "status")
if return_against_status != "Consolidated":
# if return entry is not getting merged in the current pos closing and if it is not consolidated
- bold_unconsolidated = frappe.bold("not Consolidated")
- msg = _("Row #{}: Original Invoice {} of return invoice {} is {}.").format(
- d.idx, bold_return_against, bold_pos_invoice, bold_unconsolidated
- )
+ msg = _(
+ "Row #{}: The original Invoice {} of return invoice {} is not consolidated."
+ ).format(d.idx, bold_return_against, bold_pos_invoice)
msg += " "
msg += _(
- "Original invoice should be consolidated before or along with the return invoice."
+ "The original invoice should be consolidated before or along with the return invoice."
)
msg += "
"
- msg += _("You can add original invoice {} manually to proceed.").format(
+ msg += _("You can add the original invoice {} manually to proceed.").format(
bold_return_against
)
frappe.throw(msg)
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 25b5882075a4..90900bdfbc93 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -186,7 +186,8 @@ def validate_mandatory(self):
if not self.priority:
throw(
_("As the field {0} is enabled, the field {1} is mandatory.").format(
- frappe.bold("Apply Discount on Discounted Rate"), frappe.bold("Priority")
+ frappe.bold(_("Apply Discount on Discounted Rate")),
+ frappe.bold(_("Priority")),
)
)
@@ -194,7 +195,7 @@ def validate_mandatory(self):
throw(
_(
"As the field {0} is enabled, the value of the field {1} should be more than 1."
- ).format(frappe.bold("Apply Discount on Discounted Rate"), frappe.bold("Priority"))
+ ).format(frappe.bold(_("Apply Discount on Discounted Rate")), frappe.bold(_("Priority")))
)
def validate_applicable_for_selling_or_buying(self):
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 5fb7073c7662..44d8a4070171 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -378,16 +378,16 @@ def validate_credit_to_acc(self):
if account.report_type != "Balance Sheet":
frappe.throw(
_(
- "Please ensure {} account is a Balance Sheet account. You can change the parent account to a Balance Sheet account or select a different account."
- ).format(frappe.bold("Credit To")),
+ "Please ensure that the {0} account is a Balance Sheet account. You can change the parent account to a Balance Sheet account or select a different account."
+ ).format(frappe.bold(_("Credit To"))),
title=_("Invalid Account"),
)
if self.supplier and account.account_type != "Payable":
frappe.throw(
_(
- "Please ensure {} account {} is a Payable account. Change the account type to Payable or select a different account."
- ).format(frappe.bold("Credit To"), frappe.bold(self.credit_to)),
+ "Please ensure that the {0} account {1} is a Payable account. You can change the account type to Payable or select a different account."
+ ).format(frappe.bold(_("Credit To")), frappe.bold(self.credit_to)),
title=_("Invalid Account"),
)
@@ -635,7 +635,7 @@ def po_required(self):
"To submit the invoice without purchase order please set {0} as {1} in {2}"
).format(
frappe.bold(_("Purchase Order Required")),
- frappe.bold("No"),
+ frappe.bold(_("No")),
get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"),
)
throw(msg, title=_("Mandatory Purchase Order"))
@@ -656,7 +656,7 @@ def pr_required(self):
"To submit the invoice without purchase receipt please set {0} as {1} in {2}"
).format(
frappe.bold(_("Purchase Receipt Required")),
- frappe.bold("No"),
+ frappe.bold(_("No")),
get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"),
)
throw(msg, title=_("Mandatory Purchase Receipt"))
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index cc64fd059b6b..4f62ad2f4c48 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -527,7 +527,7 @@ def check_if_consolidated_invoice(self):
)
if pos_closing_entry and pos_closing_entry[0]:
msg = _("To cancel a {} you need to cancel the POS Closing Entry {}.").format(
- frappe.bold("Consolidated Sales Invoice"),
+ frappe.bold(_("Consolidated Sales Invoice")),
get_link_to_form("POS Closing Entry", pos_closing_entry[0]),
)
frappe.throw(msg, title=_("Not Allowed"))
@@ -874,7 +874,7 @@ def validate_debit_to_acc(self):
if account.report_type != "Balance Sheet":
msg = (
- _("Please ensure {} account is a Balance Sheet account.").format(frappe.bold("Debit To"))
+ _("Please ensure {} account is a Balance Sheet account.").format(frappe.bold(_("Debit To")))
+ " "
)
msg += _(
@@ -885,7 +885,7 @@ def validate_debit_to_acc(self):
if self.customer and account.account_type != "Receivable":
msg = (
_("Please ensure {} account {} is a Receivable account.").format(
- frappe.bold("Debit To"), frappe.bold(self.debit_to)
+ frappe.bold(_("Debit To")), frappe.bold(self.debit_to)
)
+ " "
)
diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
index a6c180b9a7c8..c0d0cfd73fbf 100644
--- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
+++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py
@@ -336,7 +336,7 @@ def get_tds_docs(filters):
def get_tds_docs_query(filters, bank_accounts, tds_accounts):
if not tds_accounts:
frappe.throw(
- _("No {0} Accounts found for this company.").format(frappe.bold("Tax Withholding")),
+ _("No {0} Accounts found for this company.").format(frappe.bold(_("Tax Withholding"))),
title=_("Accounts Missing Error"),
)
gle = frappe.qb.DocType("GL Entry")
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 9bd2f98b8311..876658095736 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -670,7 +670,7 @@ def get_fixed_asset_account(self):
if not fixed_asset_account:
frappe.throw(
_("Set {0} in asset category {1} for company {2}").format(
- frappe.bold("Fixed Asset Account"),
+ frappe.bold(_("Fixed Asset Account")),
frappe.bold(self.asset_category),
frappe.bold(self.company),
),
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index ca57be3cb0c1..be28c5e93870 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -233,7 +233,7 @@ def validate(self):
).format(
frappe.bold(document_type),
get_link_to_form(self.doctype, self.get("return_against")),
- frappe.bold("Update Outstanding for Self"),
+ frappe.bold(_("Update Outstanding for Self")),
get_link_to_form("Payment Reconciliation"),
)
)
@@ -1990,7 +1990,9 @@ def company_abbr(self):
def raise_missing_debit_credit_account_error(self, party_type, party):
"""Raise an error if debit to/credit to account does not exist."""
- db_or_cr = frappe.bold("Debit To") if self.doctype == "Sales Invoice" else frappe.bold("Credit To")
+ db_or_cr = (
+ frappe.bold(_("Debit To")) if self.doctype == "Sales Invoice" else frappe.bold(_("Credit To"))
+ )
rec_or_pay = "Receivable" if self.doctype == "Sales Invoice" else "Payable"
link_to_party = frappe.utils.get_link_to_form(party_type, party)
@@ -3113,9 +3115,9 @@ def set_order_defaults(parent_doctype, parent_doctype_name, child_doctype, child
child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
if not child_item.warehouse:
frappe.throw(
- _("Cannot find {} for item {}. Please set the same in Item Master or Stock Settings.").format(
- frappe.bold("default warehouse"), frappe.bold(item.item_code)
- )
+ _(
+ "Cannot find a default warehouse for item {0}. Please set one in the Item Master or in Stock Settings."
+ ).format(frappe.bold(item.item_code))
)
set_child_tax_template_and_map(item, child_item, p_doc)
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index cc6870f892ae..5dace4af8842 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -150,7 +150,7 @@ def validate_item_attribute_value(attributes_list, attribute, attribute_value, i
)
msg += "
" + _(
"To still proceed with editing this Attribute Value, enable {0} in Item Variant Settings."
- ).format(frappe.bold("Allow Rename Attribute Value"))
+ ).format(frappe.bold(_("Allow Rename Attribute Value")))
frappe.throw(msg, InvalidItemAttributeValueError, title=_("Edit Not Allowed"))
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 2f327e1436f9..6d1b6c166077 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -694,7 +694,7 @@ def validate_for_duplicate_items(self):
duplicate_items_msg = _("Item {0} entered multiple times.").format(frappe.bold(d.item_code))
duplicate_items_msg += "
"
duplicate_items_msg += _("Please enable {} in {} to allow same item in multiple rows").format(
- frappe.bold("Allow Item to Be Added Multiple Times in a Transaction"),
+ frappe.bold(_("Allow Item to Be Added Multiple Times in a Transaction")),
get_link_to_form("Selling Settings", "Selling Settings"),
)
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
index edfab4777a78..e187c0750776 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
@@ -96,7 +96,7 @@ def add_bank_accounts(response, bank, company):
frappe.throw(
_(
"Please setup and enable a group account with the Account Type - {0} for the company {1}"
- ).format(frappe.bold("Bank"), company)
+ ).format(frappe.bold(_("Bank")), company)
)
for account in response["accounts"]:
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index f5460c85a500..3bdf93f63a97 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -202,7 +202,7 @@ def validate_advance_account_currency(self):
):
frappe.throw(
_("'{0}' should be in company currency {1}.").format(
- frappe.bold("Default Advance Received Account"), frappe.bold(self.default_currency)
+ frappe.bold(_("Default Advance Received Account")), frappe.bold(self.default_currency)
)
)
@@ -213,7 +213,7 @@ def validate_advance_account_currency(self):
):
frappe.throw(
_("'{0}' should be in company currency {1}.").format(
- frappe.bold("Default Advance Paid Account"), frappe.bold(self.default_currency)
+ frappe.bold(_("Default Advance Paid Account")), frappe.bold(self.default_currency)
)
)
@@ -444,7 +444,7 @@ def validate_provisional_account_for_non_stock_items(self):
):
frappe.throw(
_("Set default {0} account for non stock items").format(
- frappe.bold("Provisional Account")
+ frappe.bold(_("Provisional Account"))
)
)
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index c539c3157473..5d71ca06cb4b 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -188,9 +188,9 @@ def set_expiry_date(self):
if has_expiry_date and not self.expiry_date:
frappe.throw(
msg=_("Please set {0} for Batched Item {1}, which is used to set {2} on Submit.").format(
- frappe.bold("Shelf Life in Days"),
+ frappe.bold(_("Shelf Life in Days")),
get_link_to_form("Item", self.item),
- frappe.bold("Batch Expiry Date"),
+ frappe.bold(_("Batch Expiry Date")),
),
title=_("Expiry Date Mandatory"),
)
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 3d90f6b57da2..caf4cc85ae08 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -915,8 +915,8 @@ def get_basic_rate_for_manufactured_item(self, finished_item_qty, outgoing_items
).format(
item.idx,
frappe.bold(label),
- frappe.bold("Manufacture"),
- frappe.bold("Material Consumption for Manufacture"),
+ frappe.bold(_("Manufacture")),
+ frappe.bold(_("Material Consumption for Manufacture")),
)
)
@@ -926,7 +926,7 @@ def get_basic_rate_for_manufactured_item(self, finished_item_qty, outgoing_items
):
frappe.throw(
_("Only one {0} entry can be created against the Work Order {1}").format(
- frappe.bold("Manufacture"), frappe.bold(self.work_order)
+ frappe.bold(_("Manufacture")), frappe.bold(self.work_order)
)
)
diff --git a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
index 91a737536b51..6fd45ed5671b 100644
--- a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
+++ b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
@@ -255,7 +255,7 @@ def validate_reservation_based_on_serial_and_batch(self) -> None:
if self.has_batch_no
else _("Warehouse"),
frappe.bold(self.warehouse),
- frappe.bold("Stock Reservation Entry"),
+ frappe.bold(_("Stock Reservation Entry")),
)
frappe.throw(msg)
@@ -497,7 +497,8 @@ def validate_stock_reservation_settings(voucher: object) -> None:
if not frappe.db.get_single_value("Stock Settings", "enable_stock_reservation"):
msg = _("Please enable {0} in the {1}.").format(
- frappe.bold("Stock Reservation"), frappe.bold("Stock Settings")
+ frappe.bold(_("Stock Reservation")),
+ frappe.bold(_("Stock Settings")),
)
frappe.throw(msg)
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index c029b7bd1fbf..229ff9447507 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -175,7 +175,7 @@ def validate_stock_reservation(self):
if self.allow_negative_stock and self.enable_stock_reservation:
frappe.throw(
_("As {0} is enabled, you can not enable {1}.").format(
- frappe.bold("Stock Reservation"), frappe.bold("Allow Negative Stock")
+ frappe.bold(_("Stock Reservation")), frappe.bold(_("Allow Negative Stock"))
)
)
@@ -187,7 +187,7 @@ def validate_stock_reservation(self):
if self.allow_negative_stock:
frappe.throw(
_("As {0} is enabled, you can not enable {1}.").format(
- frappe.bold("Allow Negative Stock"), frappe.bold("Stock Reservation")
+ frappe.bold(_("Allow Negative Stock")), frappe.bold(_("Stock Reservation"))
)
)
@@ -207,7 +207,7 @@ def validate_stock_reservation(self):
if bin_with_negative_stock:
frappe.throw(
_("As there are negative stock, you can not enable {0}.").format(
- frappe.bold("Stock Reservation")
+ frappe.bold(_("Stock Reservation"))
)
)
@@ -221,7 +221,7 @@ def validate_stock_reservation(self):
if has_reserved_stock:
frappe.throw(
_("As there are reserved stock, you cannot disable {0}.").format(
- frappe.bold("Stock Reservation")
+ frappe.bold(_("Stock Reservation"))
)
)
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index 0fa2d61434c3..06479992283d 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -144,7 +144,7 @@ def validate_doc(self):
):
frappe.throw(
_("{0} is not enabled in {1}").format(
- frappe.bold("Track Service Level Agreement"),
+ frappe.bold(_("Track Service Level Agreement")),
get_link_to_form("Support Settings", "Support Settings"),
)
)