fix: Translatable strings (#23783)

* fix: start_pattern

* fix: translatable strings

* fix: add missing semicolon (task)

* fix: add missing semicolon (setup_wizard)

* fix: text should start on the same line

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* fix: move out HTML element as variable

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* fix: pull out message, translate "Undo".

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* fix: typo

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* fix: text should start on the same line

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* Revert "fix: start_pattern"

This reverts commit decc62e2ab.

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
Raffael Meyer
2020-11-25 04:41:51 +01:00
committed by GitHub
parent c66bd45ba4
commit fbcc3c1b70
14 changed files with 47 additions and 43 deletions

View File

@@ -94,8 +94,7 @@ frappe.ui.form.on('Chart of Accounts Importer', {
callback: function(r) { callback: function(r) {
if(r.message===false) { if(r.message===false) {
frm.set_value("company", ""); frm.set_value("company", "");
frappe.throw(__(`Transactions against the company already exist! frappe.throw(__("Transactions against the Company already exist! Chart of Accounts can only be imported for a Company with no transactions."));
Chart Of accounts can be imported for company with no transactions`));
} else { } else {
frm.trigger("refresh"); frm.trigger("refresh");
} }

View File

@@ -156,7 +156,7 @@ erpnext.accounts.bankTransactionUpload = class bankTransactionUpload {
setup_transactions_dom() { setup_transactions_dom() {
const me = this; const me = this;
me.parent.$main_section.append(`<div class="transactions-table"></div>`) me.parent.$main_section.append('<div class="transactions-table"></div>');
} }
create_datatable() { create_datatable() {
@@ -167,9 +167,7 @@ erpnext.accounts.bankTransactionUpload = class bankTransactionUpload {
}) })
} }
catch(err) { catch(err) {
let msg = __(`Your file could not be processed by ERPNext. let msg = __("Your file could not be processed. It should be a standard CSV or XLSX file with headers in the first row.");
<br>It should be a standard CSV or XLSX file.
<br>The headers should be in the first row.`)
frappe.throw(msg) frappe.throw(msg)
} }

View File

@@ -373,8 +373,8 @@ frappe.ui.form.on('Asset', {
doctype_field = frappe.scrub(doctype) doctype_field = frappe.scrub(doctype)
frm.set_value(doctype_field, ''); frm.set_value(doctype_field, '');
frappe.msgprint({ frappe.msgprint({
title: __(`Invalid ${doctype}`), title: __('Invalid {0}', [__(doctype)]),
message: __(`The selected ${doctype} doesn't contains selected Asset Item.`), message: __('The selected {0} does not contain the selected Asset Item.', [__(doctype)]),
indicator: 'red' indicator: 'red'
}); });
} }
@@ -436,7 +436,7 @@ frappe.ui.form.on('Asset Finance Book', {
depreciation_start_date: function(frm, cdt, cdn) { depreciation_start_date: function(frm, cdt, cdn) {
const book = locals[cdt][cdn]; const book = locals[cdt][cdn];
if (frm.doc.available_for_use_date && book.depreciation_start_date == frm.doc.available_for_use_date) { if (frm.doc.available_for_use_date && book.depreciation_start_date == frm.doc.available_for_use_date) {
frappe.msgprint(__(`Depreciation Posting Date should not be equal to Available for Use Date.`)); frappe.msgprint(__("Depreciation Posting Date should not be equal to Available for Use Date."));
book.depreciation_start_date = ""; book.depreciation_start_date = "";
frm.refresh_field("finance_books"); frm.refresh_field("finance_books");
} }

View File

@@ -4,7 +4,7 @@ function check_times(frm) {
let from_time = Date.parse('01/01/2019 ' + d.from_time); let from_time = Date.parse('01/01/2019 ' + d.from_time);
let to_time = Date.parse('01/01/2019 ' + d.to_time); let to_time = Date.parse('01/01/2019 ' + d.to_time);
if (from_time > to_time) { if (from_time > to_time) {
frappe.throw(__(`In row ${i + 1} of Appointment Booking Slots : "To Time" must be later than "From Time"`)); frappe.throw(__('In row {0} of Appointment Booking Slots: "To Time" must be later than "From Time".', [i + 1]));
} }
}); });
} }

View File

@@ -49,7 +49,10 @@ frappe.ui.form.on("Task", {
}, },
callback: function (r) { callback: function (r) {
if (r.message.length > 0) { if (r.message.length > 0) {
frappe.msgprint(__(`Cannot convert it to non-group. The following child Tasks exist: ${r.message.join(", ")}.`)); let message = __('Cannot convert Task to non-group because the following child Tasks exist: {0}.',
[r.message.join(", ")]
);
frappe.msgprint(message);
frm.reload_doc(); frm.reload_doc();
} }
} }

View File

@@ -32,7 +32,7 @@ export default {
item_id_fieldname: 'name', item_id_fieldname: 'name',
// Constants // Constants
empty_state_message: __(`No items in this category yet.`), empty_state_message: __('No items in this category yet.'),
search_value: '', search_value: '',

View File

@@ -33,10 +33,8 @@ export default {
// Constants // Constants
page_title: __('Your Featured Items'), page_title: __('Your Featured Items'),
empty_state_message: __(`No featured items yet. Got to your empty_state_message: __('No featured items yet. Got to your {0} and feature up to eight items that you want to highlight to your customers.',
<a href="#marketplace/published-items"> [`<a href="#marketplace/published-items">${__("Published Items")}</a>`])
Published Items</a>
and feature upto 8 items that you want to highlight to your customers.`)
}; };
}, },
created() { created() {
@@ -71,9 +69,9 @@ export default {
const item_name = this.items.filter(item => item.hub_item_name === hub_item_name); const item_name = this.items.filter(item => item.hub_item_name === hub_item_name);
alert = frappe.show_alert(__(`<span>${item_name} removed. alert_message = __('{0} removed. {1}', [item_name,
<a href="#" data-action="undo-remove"><b>Undo</b></a></span>`), `<a href="#" data-action="undo-remove"><b>${__('Undo')}</b></a>`]);
grace_period/1000, alert = frappe.show_alert(alert_message, grace_period / 1000,
{ {
'undo-remove': undo_remove.bind(this) 'undo-remove': undo_remove.bind(this)
} }

View File

@@ -113,12 +113,12 @@ export default {
let stats = __('No views yet'); let stats = __('No views yet');
if (this.item.view_count) { if (this.item.view_count) {
const views_message = __(`${this.item.view_count} Views`); const views_message = __('{0} Views', [this.item.view_count]);
const rating_html = get_rating_html(this.item.average_rating); const rating_html = get_rating_html(this.item.average_rating);
const rating_count = const rating_count =
this.item.no_of_ratings > 0 this.item.no_of_ratings > 0
? `${this.item.no_of_ratings} reviews` ? __('{0} reviews', [this.item.no_of_ratings])
: __('No reviews yet'); : __('No reviews yet');
stats = [views_message, rating_html, rating_count]; stats = [views_message, rating_html, rating_count];
@@ -310,7 +310,7 @@ export default {
return this.get_item_details(); return this.get_item_details();
}) })
.then(() => { .then(() => {
frappe.show_alert(__(`${this.item.item_name} Updated`)); frappe.show_alert(__('{0} Updated', [this.item.item_name]));
}); });
}, },
@@ -337,7 +337,7 @@ export default {
}, },
unpublish_item() { unpublish_item() {
frappe.confirm(__(`Unpublish {0}?`, [this.item.item_name]), () => { frappe.confirm(__('Unpublish {0}?', [this.item.item_name]), () => {
frappe frappe
.call('erpnext.hub_node.api.unpublish_item', { .call('erpnext.hub_node.api.unpublish_item', {
item_code: this.item.item_code, item_code: this.item.item_code,

View File

@@ -27,7 +27,7 @@ export default {
}, },
// Constants // Constants
empty_state_message: __(`Sorry! I could not find what you were looking for.`) empty_state_message: __('Sorry! We could not find what you were looking for.')
}; };
}, },
} }

View File

@@ -75,14 +75,11 @@ export default {
// TODO: multiline translations don't work // TODO: multiline translations don't work
page_title: __('Publish Items'), page_title: __('Publish Items'),
search_placeholder: __('Search Items ...'), search_placeholder: __('Search Items ...'),
empty_state_message: __(`No Items selected yet. Browse and click on items below to publish.`), empty_state_message: __('No Items selected yet. Browse and click on items below to publish.'),
valid_items_instruction: __(`Only items with an image and description can be published. Please update them if an item in your inventory does not appear.`), valid_items_instruction: __('Only items with an image and description can be published. Please update them if an item in your inventory does not appear.'),
last_sync_message: (hub.settings.last_sync_datetime) last_sync_message: (hub.settings.last_sync_datetime)
? __(`Last sync was ? __('Last sync was {0}.', [`<a href="#marketplace/profile">${comment_when(hub.settings.last_sync_datetime)}</a>`]) +
<a href="#marketplace/profile"> ` <a href="#marketplace/published-items">${__('See your Published Items.')}</a>`
${comment_when(hub.settings.last_sync_datetime)}</a>.
<a href="#marketplace/published-items">
See your Published Items</a>.`)
: '' : ''
}; };
}, },
@@ -147,11 +144,9 @@ export default {
}, },
add_last_sync_message() { add_last_sync_message() {
this.last_sync_message = __(`Last sync was this.last_sync_message = __('Last sync was {0}.',
<a href="#marketplace/profile"> [`<a href="#marketplace/profile">${comment_when(hub.settings.last_sync_datetime)}</a>`]
${comment_when(hub.settings.last_sync_datetime)}</a>. ) + `<a href="#marketplace/published-items">${__('See your Published Items')}</a>.`;
<a href="#marketplace/published-items">
See your Published Items</a>.`);
}, },
clear_last_sync_message() { clear_last_sync_message() {

View File

@@ -29,7 +29,7 @@ export default {
// Constants // Constants
page_title: __('Saved Items'), page_title: __('Saved Items'),
empty_state_message: __(`You haven't saved any items yet.`) empty_state_message: __('You have not saved any items yet.')
}; };
}, },
created() { created() {
@@ -64,8 +64,13 @@ export default {
const item_name = this.items.filter(item => item.hub_item_name === hub_item_name); const item_name = this.items.filter(item => item.hub_item_name === hub_item_name);
alert = frappe.show_alert(__(`<span>${item_name} removed. alert = frappe.show_alert(`
<a href="#" data-action="undo-remove"><b>Undo</b></a></span>`), <span>
${__('{0} removed.', [item_name], 'A specific Item has been removed.')}
<a href="#" data-action="undo-remove">
<b>${__('Undo', None, 'Undo removal of item.')}</b>
</a>
</span>`,
grace_period/1000, grace_period/1000,
{ {
'undo-remove': undo_remove.bind(this) 'undo-remove': undo_remove.bind(this)

View File

@@ -42,7 +42,10 @@ export default {
computed: { computed: {
page_title() { page_title() {
return this.items.length return this.items.length
? __(`Results for "${this.search_value}" ${this.category !== 'All'? `in category ${this.category}` : ''}`) ? __('Results for "{0}" {1}', [
this.search_value,
this.category !== 'All' ? __('in category {0}', [this.category]) : ''
])
: __('No Items found.'); : __('No Items found.');
} }
}, },

View File

@@ -136,7 +136,7 @@ export default {
this.init = false; this.init = false;
this.profile = data.profile; this.profile = data.profile;
this.items = data.items; this.items = data.items;
this.item_container_heading = data.is_featured_item? "Features Items":"Popular Items"; this.item_container_heading = data.is_featured_item ? __('Featured Items') : __('Popular Items');
this.hub_seller = this.items[0].hub_seller; this.hub_seller = this.items[0].hub_seller;
this.recent_seller_reviews = data.recent_seller_reviews; this.recent_seller_reviews = data.recent_seller_reviews;
this.seller_product_view_stats = data.seller_product_view_stats; this.seller_product_view_stats = data.seller_product_view_stats;
@@ -147,7 +147,7 @@ export default {
this.country = __(profile.country); this.country = __(profile.country);
this.site_name = __(profile.site_name); this.site_name = __(profile.site_name);
this.joined_when = __(`Joined ${comment_when(profile.creation)}`); this.joined_when = __('Joined {0}', [comment_when(profile.creation)]);
this.image = profile.logo; this.image = profile.logo;
this.sections = [ this.sections = [

View File

@@ -161,7 +161,10 @@ erpnext.setup.slides_settings = [
if(r.message){ if(r.message){
exist = r.message; exist = r.message;
me.get_field("bank_account").set_value(""); me.get_field("bank_account").set_value("");
frappe.msgprint(__(`Account ${me.values.bank_account} already exists, enter a different name for your bank account`)); let message = __('Account {0} already exists. Please enter a different name for your bank account.',
[me.values.bank_account]
);
frappe.msgprint(message);
} }
} }
}); });