Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: translatability of boldened text #2093

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hrms/hr/doctype/appraisal_cycle/appraisal_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ def create_appraisals_for_cycle(appraisal_cycle: AppraisalCycle, publish_progres

def validate_active_appraisal_cycle(appraisal_cycle: str) -> None:
if frappe.db.get_value("Appraisal Cycle", appraisal_cycle, "status") == "Completed":
msg = _("Cannot create or change transactions against a {0} Appraisal Cycle.").format(
frappe.bold("Completed")
msg = _("Cannot create or change transactions against an Appraisal Cycle with status {0}.").format(
frappe.bold(_("Completed"))
)
msg += "<br><br>"
msg += _("Mark the cycle as {0} if required.").format(frappe.bold("In Progress"))
msg += _("Set the status to {0} if required.").format(frappe.bold(_("In Progress")))

frappe.throw(msg, title=_("Not Allowed"))

Expand Down
10 changes: 5 additions & 5 deletions hrms/hr/doctype/exit_interview/exit_interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def validate_questionnaire_settings():
if not settings.exit_questionnaire_web_form or not settings.exit_questionnaire_notification_template:
frappe.throw(
_("Please set {0} and {1} in {2}.").format(
frappe.bold("Exit Questionnaire Web Form"),
frappe.bold("Notification Template"),
frappe.bold(_("Exit Questionnaire Web Form")),
frappe.bold(_("Notification Template")),
get_link_to_form("HR Settings", "HR Settings"),
),
title=_("Settings Missing"),
Expand All @@ -129,12 +129,12 @@ def validate_questionnaire_settings():
def show_email_summary(email_success, email_failure):
message = ""
if email_success:
message += _("{0}: {1}").format(frappe.bold("Sent Successfully"), ", ".join(email_success))
message += _("Sent Successfully: {0}").format(", ".join(email_success))
if message and email_failure:
message += "<br><br>"
if email_failure:
message += _("{0} due to missing email information for employee(s): {1}").format(
frappe.bold("Sending Failed"), ", ".join(email_failure)
message += _("Sending Failed due to missing email information for employee(s): {1}").format(
", ".join(email_failure)
)

frappe.msgprint(message, title=_("Exit Questionnaire"), indicator="blue", is_minimizable=True, wide=True)
5 changes: 3 additions & 2 deletions hrms/hr/doctype/expense_claim/expense_claim.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def validate_account_details(self):
if not data.cost_center:
frappe.throw(
_("Row {0}: {1} is required in the expenses table to book an expense claim.").format(
data.idx, frappe.bold("Cost Center")
data.idx, frappe.bold(_("Cost Center"))
)
)

Expand Down Expand Up @@ -471,7 +471,8 @@ def get_expense_claim_account(expense_claim_type, company):
if not account:
frappe.throw(
_("Set the default account for the {0} {1}").format(
frappe.bold("Expense Claim Type"), get_link_to_form("Expense Claim Type", expense_claim_type)
frappe.bold(_("Expense Claim Type")),
get_link_to_form("Expense Claim Type", expense_claim_type),
)
)

Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/interview_feedback/interview_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def validate_interview_date(self):

if getdate() < getdate(scheduled_date) and self.docstatus == 1:
frappe.throw(
_("{0} submission before {1} is not allowed").format(
frappe.bold("Interview Feedback"), frappe.bold("Interview Scheduled Date")
_("Submission of {0} before {1} is not allowed").format(
frappe.bold(_("Interview Feedback")), frappe.bold(_("Interview Scheduled Date"))
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ def validate_dates(self):
def validate_standard_working_hours(self):
self.standard_working_hours = frappe.db.get_single_value("HR Settings", "standard_working_hours")
if not self.standard_working_hours:
msg = _(
"The metrics for this report are calculated based on the Standard Working Hours. Please set {0} in {1}."
).format(
frappe.bold("Standard Working Hours"),
msg = _("The metrics for this report are calculated based on {0}. Please set {0} in {1}.").format(
frappe.bold(_("Standard Working Hours")),
frappe.utils.get_link_to_form("HR Settings", "HR Settings"),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ def get_standard_working_hours() -> float | None:
standard_working_hours = frappe.db.get_single_value("HR Settings", "standard_working_hours")
if not standard_working_hours:
frappe.throw(
_(
"The metrics for this report are calculated based on the Standard Working Hours. Please set {0} in {1}."
).format(
frappe.bold("Standard Working Hours"),
_("The metrics for this report are calculated based on the {0}. Please set {0} in {1}.").format(
frappe.bold(_("Standard Working Hours")),
frappe.utils.get_link_to_form("HR Settings", "HR Settings"),
)
)
Expand Down
4 changes: 1 addition & 3 deletions hrms/hr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@ def share_doc_with_approver(doc, user):
doc.doctype, doc.name, user, submit=1, flags={"ignore_share_permission": True}
)

frappe.msgprint(
_("Shared with the user {0} with {1} access").format(user, frappe.bold("submit"), alert=True)
)
frappe.msgprint(_("Shared with the user {0} with 'submit' permisions").format(user, alert=True))

# remove shared doc if approver changes
doc_before_save = doc.get_doc_before_save()
Expand Down
4 changes: 2 additions & 2 deletions hrms/overrides/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ def validate_default_accounts(doc, method=None):
if get_account_currency(doc.default_payroll_payable_account) != doc.default_currency:
frappe.throw(
_(
"{0} currency must be same as company's default currency. Please select another account."
).format(frappe.bold("Default Payroll Payable Account"))
"The currency of {0} should be same as the company's default currency. Please select another account."
).format(frappe.bold(_("Default Payroll Payable Account")))
)
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def validate_employee_referral(self):
frappe.throw(
_(
"Additional Salary for referral bonus can only be created against Employee Referral with status {0}"
).format(frappe.bold("Accepted"))
).format(frappe.bold(_("Accepted")))
)

def validate_duplicate_additional_salary(self):
Expand Down
6 changes: 3 additions & 3 deletions hrms/payroll/doctype/salary_structure/salary_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def validate_payment_days_based_dependent_component(self):
message = _("Row #{0}: The {1} Component has the options {2} and {3} enabled.").format(
row.idx,
frappe.bold(row.salary_component),
frappe.bold("Amount based on formula"),
frappe.bold("Depends On Payment Days"),
frappe.bold(_("Amount based on formula")),
frappe.bold(_("Depends On Payment Days")),
)
message += "<br><br>" + _(
"Disable {0} for the {1} component, to prevent the amount from being deducted twice, as its formula already uses a payment-days-based component."
).format(frappe.bold("Depends On Payment Days"), frappe.bold(row.salary_component))
).format(frappe.bold(_("Depends On Payment Days")), frappe.bold(row.salary_component))
frappe.throw(message, title=_("Payment Days Dependency"))

def get_component_abbreviations(self):
Expand Down
Loading