fix: translatability of boldened text

This commit is contained in:
barredterra
2024-08-16 21:38:56 +02:00
parent 1bdeddcb04
commit af0ae930ca
19 changed files with 50 additions and 51 deletions

View File

@@ -200,7 +200,7 @@ class Account(NestedSet):
msg = _( msg = _(
"There are ledger entries against this account. Changing {0} to non-{1} in live system will cause incorrect output in 'Accounts {2}' report" "There are ledger entries against this account. Changing {0} to non-{1} in live system will cause incorrect output in 'Accounts {2}' report"
).format( ).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) frappe.msgprint(msg)
self.add_comment("Comment", msg) self.add_comment("Comment", msg)

View File

@@ -87,19 +87,15 @@ class POSClosingEntry(StatusUpdater):
as_dict=1, as_dict=1,
)[0] )[0]
if pos_invoice.consolidated_invoice: if pos_invoice.consolidated_invoice:
invalid_row.setdefault("msg", []).append( invalid_row.setdefault("msg", []).append(_("POS Invoice is already consolidated"))
_("POS Invoice is {}").format(frappe.bold("already consolidated"))
)
invalid_rows.append(invalid_row) invalid_rows.append(invalid_row)
continue continue
if pos_invoice.pos_profile != self.pos_profile: if pos_invoice.pos_profile != self.pos_profile:
invalid_row.setdefault("msg", []).append( 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: if pos_invoice.docstatus != 1:
invalid_row.setdefault("msg", []).append( invalid_row.setdefault("msg", []).append(_("POS Invoice is not submitted"))
_("POS Invoice is not {}").format(frappe.bold("submitted"))
)
if pos_invoice.owner != self.user: if pos_invoice.owner != self.user:
invalid_row.setdefault("msg", []).append( invalid_row.setdefault("msg", []).append(
_("POS Invoice isn't created by user {}").format(frappe.bold(self.owner)) _("POS Invoice isn't created by user {}").format(frappe.bold(self.owner))

View File

@@ -188,7 +188,7 @@ class POSInvoice(SalesInvoice):
def validate(self): def validate(self):
if not cint(self.is_pos): if not cint(self.is_pos):
frappe.throw( 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 # run on validate method of selling controller

View File

@@ -97,16 +97,15 @@ class POSInvoiceMergeLog(Document):
return_against_status = frappe.db.get_value("POS Invoice", return_against, "status") return_against_status = frappe.db.get_value("POS Invoice", return_against, "status")
if return_against_status != "Consolidated": if return_against_status != "Consolidated":
# if return entry is not getting merged in the current pos closing and if it is not 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 = _(
msg = _("Row #{}: Original Invoice {} of return invoice {} is {}.").format( "Row #{}: The original Invoice {} of return invoice {} is not consolidated."
d.idx, bold_return_against, bold_pos_invoice, bold_unconsolidated ).format(d.idx, bold_return_against, bold_pos_invoice)
)
msg += " " msg += " "
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 += "<br><br>" msg += "<br><br>"
msg += _("You can add original invoice {} manually to proceed.").format( msg += _("You can add the original invoice {} manually to proceed.").format(
bold_return_against bold_return_against
) )
frappe.throw(msg) frappe.throw(msg)

View File

@@ -186,7 +186,8 @@ class PricingRule(Document):
if not self.priority: if not self.priority:
throw( throw(
_("As the field {0} is enabled, the field {1} is mandatory.").format( _("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 @@ class PricingRule(Document):
throw( throw(
_( _(
"As the field {0} is enabled, the value of the field {1} should be more than 1." "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): def validate_applicable_for_selling_or_buying(self):

View File

@@ -378,16 +378,16 @@ class PurchaseInvoice(BuyingController):
if account.report_type != "Balance Sheet": if account.report_type != "Balance Sheet":
frappe.throw( 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." "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")), ).format(frappe.bold(_("Credit To"))),
title=_("Invalid Account"), title=_("Invalid Account"),
) )
if self.supplier and account.account_type != "Payable": if self.supplier and account.account_type != "Payable":
frappe.throw( frappe.throw(
_( _(
"Please ensure {} account {} is a Payable account. Change the account type to Payable or select a different account." "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)), ).format(frappe.bold(_("Credit To")), frappe.bold(self.credit_to)),
title=_("Invalid Account"), title=_("Invalid Account"),
) )
@@ -635,7 +635,7 @@ class PurchaseInvoice(BuyingController):
"To submit the invoice without purchase order please set {0} as {1} in {2}" "To submit the invoice without purchase order please set {0} as {1} in {2}"
).format( ).format(
frappe.bold(_("Purchase Order Required")), frappe.bold(_("Purchase Order Required")),
frappe.bold("No"), frappe.bold(_("No")),
get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"), get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"),
) )
throw(msg, title=_("Mandatory Purchase Order")) throw(msg, title=_("Mandatory Purchase Order"))
@@ -656,7 +656,7 @@ class PurchaseInvoice(BuyingController):
"To submit the invoice without purchase receipt please set {0} as {1} in {2}" "To submit the invoice without purchase receipt please set {0} as {1} in {2}"
).format( ).format(
frappe.bold(_("Purchase Receipt Required")), frappe.bold(_("Purchase Receipt Required")),
frappe.bold("No"), frappe.bold(_("No")),
get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"), get_link_to_form("Buying Settings", "Buying Settings", "Buying Settings"),
) )
throw(msg, title=_("Mandatory Purchase Receipt")) throw(msg, title=_("Mandatory Purchase Receipt"))

View File

@@ -527,7 +527,7 @@ class SalesInvoice(SellingController):
) )
if pos_closing_entry and pos_closing_entry[0]: if pos_closing_entry and pos_closing_entry[0]:
msg = _("To cancel a {} you need to cancel the POS Closing Entry {}.").format( 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]), get_link_to_form("POS Closing Entry", pos_closing_entry[0]),
) )
frappe.throw(msg, title=_("Not Allowed")) frappe.throw(msg, title=_("Not Allowed"))
@@ -874,7 +874,7 @@ class SalesInvoice(SellingController):
if account.report_type != "Balance Sheet": if account.report_type != "Balance Sheet":
msg = ( 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 += _( msg += _(
@@ -885,7 +885,7 @@ class SalesInvoice(SellingController):
if self.customer and account.account_type != "Receivable": if self.customer and account.account_type != "Receivable":
msg = ( msg = (
_("Please ensure {} account {} is a Receivable account.").format( _("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)
) )
+ " " + " "
) )

View File

@@ -336,7 +336,7 @@ def get_tds_docs(filters):
def get_tds_docs_query(filters, bank_accounts, tds_accounts): def get_tds_docs_query(filters, bank_accounts, tds_accounts):
if not tds_accounts: if not tds_accounts:
frappe.throw( 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"), title=_("Accounts Missing Error"),
) )
gle = frappe.qb.DocType("GL Entry") gle = frappe.qb.DocType("GL Entry")

View File

@@ -670,7 +670,7 @@ class Asset(AccountsController):
if not fixed_asset_account: if not fixed_asset_account:
frappe.throw( frappe.throw(
_("Set {0} in asset category {1} for company {2}").format( _("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.asset_category),
frappe.bold(self.company), frappe.bold(self.company),
), ),

View File

@@ -233,7 +233,7 @@ class AccountsController(TransactionBase):
).format( ).format(
frappe.bold(document_type), frappe.bold(document_type),
get_link_to_form(self.doctype, self.get("return_against")), 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"), get_link_to_form("Payment Reconciliation"),
) )
) )
@@ -1990,7 +1990,9 @@ class AccountsController(TransactionBase):
def raise_missing_debit_credit_account_error(self, party_type, party): def raise_missing_debit_credit_account_error(self, party_type, party):
"""Raise an error if debit to/credit to account does not exist.""" """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" rec_or_pay = "Receivable" if self.doctype == "Sales Invoice" else "Payable"
link_to_party = frappe.utils.get_link_to_form(party_type, party) 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) child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
if not child_item.warehouse: if not child_item.warehouse:
frappe.throw( 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) set_child_tax_template_and_map(item, child_item, p_doc)

View File

@@ -150,7 +150,7 @@ def validate_item_attribute_value(attributes_list, attribute, attribute_value, i
) )
msg += "<br>" + _( msg += "<br>" + _(
"To still proceed with editing this Attribute Value, enable {0} in Item Variant Settings." "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")) frappe.throw(msg, InvalidItemAttributeValueError, title=_("Edit Not Allowed"))

View File

@@ -694,7 +694,7 @@ class SellingController(StockController):
duplicate_items_msg = _("Item {0} entered multiple times.").format(frappe.bold(d.item_code)) duplicate_items_msg = _("Item {0} entered multiple times.").format(frappe.bold(d.item_code))
duplicate_items_msg += "<br><br>" duplicate_items_msg += "<br><br>"
duplicate_items_msg += _("Please enable {} in {} to allow same item in multiple rows").format( 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"), get_link_to_form("Selling Settings", "Selling Settings"),
) )
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1: if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:

View File

@@ -96,7 +96,7 @@ def add_bank_accounts(response, bank, company):
frappe.throw( frappe.throw(
_( _(
"Please setup and enable a group account with the Account Type - {0} for the company {1}" "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"]: for account in response["accounts"]:

View File

@@ -202,7 +202,7 @@ class Company(NestedSet):
): ):
frappe.throw( frappe.throw(
_("'{0}' should be in company currency {1}.").format( _("'{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 @@ class Company(NestedSet):
): ):
frappe.throw( frappe.throw(
_("'{0}' should be in company currency {1}.").format( _("'{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 @@ class Company(NestedSet):
): ):
frappe.throw( frappe.throw(
_("Set default {0} account for non stock items").format( _("Set default {0} account for non stock items").format(
frappe.bold("Provisional Account") frappe.bold(_("Provisional Account"))
) )
) )

View File

@@ -188,9 +188,9 @@ class Batch(Document):
if has_expiry_date and not self.expiry_date: if has_expiry_date and not self.expiry_date:
frappe.throw( frappe.throw(
msg=_("Please set {0} for Batched Item {1}, which is used to set {2} on Submit.").format( 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), get_link_to_form("Item", self.item),
frappe.bold("Batch Expiry Date"), frappe.bold(_("Batch Expiry Date")),
), ),
title=_("Expiry Date Mandatory"), title=_("Expiry Date Mandatory"),
) )

View File

@@ -915,8 +915,8 @@ class StockEntry(StockController):
).format( ).format(
item.idx, item.idx,
frappe.bold(label), frappe.bold(label),
frappe.bold("Manufacture"), frappe.bold(_("Manufacture")),
frappe.bold("Material Consumption for Manufacture"), frappe.bold(_("Material Consumption for Manufacture")),
) )
) )
@@ -926,7 +926,7 @@ class StockEntry(StockController):
): ):
frappe.throw( frappe.throw(
_("Only one {0} entry can be created against the Work Order {1}").format( _("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)
) )
) )

View File

@@ -255,7 +255,7 @@ class StockReservationEntry(Document):
if self.has_batch_no if self.has_batch_no
else _("Warehouse"), else _("Warehouse"),
frappe.bold(self.warehouse), frappe.bold(self.warehouse),
frappe.bold("Stock Reservation Entry"), frappe.bold(_("Stock Reservation Entry")),
) )
frappe.throw(msg) 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"): if not frappe.db.get_single_value("Stock Settings", "enable_stock_reservation"):
msg = _("Please enable {0} in the {1}.").format( 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) frappe.throw(msg)

View File

@@ -175,7 +175,7 @@ class StockSettings(Document):
if self.allow_negative_stock and self.enable_stock_reservation: if self.allow_negative_stock and self.enable_stock_reservation:
frappe.throw( frappe.throw(
_("As {0} is enabled, you can not enable {1}.").format( _("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 @@ class StockSettings(Document):
if self.allow_negative_stock: if self.allow_negative_stock:
frappe.throw( frappe.throw(
_("As {0} is enabled, you can not enable {1}.").format( _("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 @@ class StockSettings(Document):
if bin_with_negative_stock: if bin_with_negative_stock:
frappe.throw( frappe.throw(
_("As there are negative stock, you can not enable {0}.").format( _("As there are negative stock, you can not enable {0}.").format(
frappe.bold("Stock Reservation") frappe.bold(_("Stock Reservation"))
) )
) )
@@ -221,7 +221,7 @@ class StockSettings(Document):
if has_reserved_stock: if has_reserved_stock:
frappe.throw( frappe.throw(
_("As there are reserved stock, you cannot disable {0}.").format( _("As there are reserved stock, you cannot disable {0}.").format(
frappe.bold("Stock Reservation") frappe.bold(_("Stock Reservation"))
) )
) )

View File

@@ -144,7 +144,7 @@ class ServiceLevelAgreement(Document):
): ):
frappe.throw( frappe.throw(
_("{0} is not enabled in {1}").format( _("{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"), get_link_to_form("Support Settings", "Support Settings"),
) )
) )