Преглед на файлове

fix: add translate function to some strings (backport #18188) (#18242)

* fix: add translate function to some strings (#18188)

* fix: typo on dashboard_view

* fix: add string to translate function

* fix: add string to translate function

* fix: add string to translate function

* fix: upddate translatet text to single quote

* fix: update translated strings to single quote

* fix: add country to translate function

* fix: add country to translate function

* fix: add string to translate function

* fix: add string to translate function

* fix: add string to translate function

* fix: Revert translate for country

* fix: revert single quote to Search for icons text

* fix: refactor the translate labels directly to html variable

(cherry picked from commit d399951fab)

* style: prettier

Co-authored-by: Ernesto Ruiz <ernesto_ruiz89@hotmail.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
version-14
mergify[bot] преди 2 години
committed by GitHub
родител
ревизия
c929fe6c2a
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 7 файла, в които са добавени 70 реда и са изтрити 52 реда
  1. +1
    -1
      frappe/public/js/frappe/views/dashboard/dashboard_view.js
  2. +2
    -2
      frappe/public/js/frappe/views/workspace/blocks/block.js
  3. +1
    -1
      frappe/public/js/frappe/views/workspace/blocks/paragraph.js
  4. +1
    -1
      frappe/public/js/frappe/views/workspace/blocks/spacer.js
  5. +54
    -36
      frappe/public/js/frappe/views/workspace/workspace.js
  6. +6
    -6
      frappe/public/js/frappe/widgets/quick_list_widget.js
  7. +5
    -5
      frappe/public/js/frappe/widgets/widget_dialog.js

+ 1
- 1
frappe/public/js/frappe/views/dashboard/dashboard_view.js Целия файл

@@ -395,7 +395,7 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
fieldtype: "Select",
fieldname: "aggregate_function_based_on",
options: fields.aggregate_function_fields,
depends_on: 'eval: ["Sum", "Avergage"].includes(doc.group_by_type)',
depends_on: 'eval: ["Sum", "Average"].includes(doc.group_by_type)',
},
{
fieldname: "cb_2",


+ 2
- 2
frappe/public/js/frappe/views/workspace/blocks/block.js Целия файл

@@ -200,9 +200,9 @@ export default class Block {

let dropdown_item = function (label, title, icon, action) {
let html = $(`
<div class="dropdown-item" title="${title}">
<div class="dropdown-item" title="${__(title)}">
<span class="dropdown-item-icon">${icon}</span>
<span class="dropdown-item-label">${label}</span>
<span class="dropdown-item-label">${__(label)}</span>
</div>
`);



+ 1
- 1
frappe/public/js/frappe/views/workspace/blocks/paragraph.js Целия файл

@@ -75,7 +75,7 @@ export default class Paragraph extends Block {
}

open_block_list() {
let dropdown_title = "Templates";
let dropdown_title = __("Templates");
let $block_list_container = $(`
<div class="block-list-container dropdown-list">
<div class="dropdown-title">${dropdown_title.toUpperCase()}</div>


+ 1
- 1
frappe/public/js/frappe/views/workspace/blocks/spacer.js Целия файл

@@ -23,7 +23,7 @@ export default class Spacer extends Block {
let $spacer = $(`
<div class="widget-head">
<div class="spacer-left"></div>
<div>Spacer</div>
<div>${__("Spacer")}</div>
<div class="widget-control"></div>
</div>
`);


+ 54
- 36
frappe/public/js/frappe/views/workspace/workspace.js Целия файл

@@ -578,8 +578,10 @@ frappe.views.Workspace = class Workspace {
},
callback: function (res) {
if (res.message) {
let message = `Workspace <b>${old_item.title}</b> Edited Successfully`;
frappe.show_alert({ message: __(message), indicator: "green" });
let message = __("Workspace {0} Edited Successfully", [
old_item.title.bold(),
]);
frappe.show_alert({ message: message, indicator: "green" });
}
},
});
@@ -706,20 +708,20 @@ frappe.views.Workspace = class Workspace {
add_settings_button(item, sidebar_control) {
this.dropdown_list = [
{
label: "Edit",
title: "Edit Workspace",
label: __("Edit"),
title: __("Edit Workspace"),
icon: frappe.utils.icon("edit", "sm"),
action: () => this.edit_page(item),
},
{
label: "Duplicate",
title: "Duplicate Workspace",
label: __("Duplicate"),
title: __("Duplicate Workspace"),
icon: frappe.utils.icon("duplicate", "sm"),
action: () => this.duplicate_page(item),
},
{
label: "Delete",
title: "Delete Workspace",
label: __("Delete"),
title: __("Delete Workspace"),
icon: frappe.utils.icon("delete-active", "sm"),
action: () => this.delete_page(item),
},
@@ -766,29 +768,37 @@ frappe.views.Workspace = class Workspace {
}

delete_page(page) {
frappe.confirm(__("Are you sure you want to delete page {0}?", [page.title]), () => {
frappe.call({
method: "frappe.desk.doctype.workspace.workspace.delete_page",
args: { page: page },
callback: function (res) {
if (res.message) {
let page = res.message;
let message = `Workspace <b>${page.title}</b> Deleted Successfully`;
frappe.show_alert({ message: __(message), indicator: "green" });
}
},
});
frappe.confirm(
__("Are you sure you want to delete page {0}?", [page.title.bold()]),
() => {
frappe.call({
method: "frappe.desk.doctype.workspace.workspace.delete_page",
args: { page: page },
callback: function (res) {
if (res.message) {
let page = res.message;
let message = __("Workspace {0} Deleted Successfully", [
page.title.bold(),
]);
frappe.show_alert({ message: message, indicator: "green" });
}
},
});

this.page.clear_primary_action();
this.update_cached_values(page);
this.page.clear_primary_action();
this.update_cached_values(page);

if (this.current_page.name == page.title && this.current_page.public == page.public) {
frappe.set_route("/");
}
if (
this.current_page.name == page.title &&
this.current_page.public == page.public
) {
frappe.set_route("/");
}

this.make_sidebar();
this.show_sidebar_actions();
});
this.make_sidebar();
this.show_sidebar_actions();
}
);
}

duplicate_page(page) {
@@ -851,8 +861,11 @@ frappe.views.Workspace = class Workspace {
callback: function (res) {
if (res.message) {
let new_page = res.message;
let message = `Duplicate of <b>${page.title}</b> named as <b>${new_page.title}</b> is created successfully`;
frappe.show_alert({ message: __(message), indicator: "green" });
let message = __(
"Duplicate of {0} named as {1} is created successfully",
[page.title.bold(), new_page.title.bold()]
);
frappe.show_alert({ message: message, indicator: "green" });
}
},
});
@@ -1071,9 +1084,11 @@ frappe.views.Workspace = class Workspace {
},
callback: function (res) {
if (res.message) {
let message = `Workspace <b>${new_page.title}</b> Created Successfully`;
let message = __("Workspace {0} Created Successfully", [
new_page.title.bold(),
]);
frappe.show_alert({
message: __(message),
message: message,
indicator: "green",
});
}
@@ -1103,18 +1118,21 @@ frappe.views.Workspace = class Workspace {
let section = this.sidebar_categories[new_page.is_public];

if (to_pages && to_pages.filter((p) => p.title == new_page.title)[0]) {
message = `Page with title ${new_page.title} already exist.`;
message = __("Page with title {0} already exist.", [new_page.title.bold()]);
}

if (frappe.router.doctype_route_exist(frappe.router.slug(new_page.title))) {
message = "Doctype with same route already exist. Please choose different title.";
message = __("Doctype with same route already exist. Please choose different title.");
}

let child_pages = old_page && from_pages.filter((p) => p.parent_page == old_page.title);
if (child_pages) {
child_pages.every((child_page) => {
if (to_pages && to_pages.find((p) => p.title == child_page.title)) {
message = `One of the child page with name <b>${child_page.title}</b> already exist in <b>${section}</b> Section. Please update the name of the child page first before moving`;
message = __(
"One of the child page with name {0} already exist in {1} Section. Please update the name of the child page first before moving",
[child_page.title.bold(), section.bold()]
);
cur_dialog.hide();
return false;
}
@@ -1186,7 +1204,7 @@ frappe.views.Workspace = class Workspace {
class: this.blocks["paragraph"],
inlineToolbar: ["HeaderSize", "bold", "italic", "link"],
config: {
placeholder: "Choose a block or continue typing",
placeholder: __("Choose a block or continue typing"),
},
},
chart: {


+ 6
- 6
frappe/public/js/frappe/widgets/quick_list_widget.js Целия файл

@@ -26,9 +26,9 @@ export default class QuickListWidget extends Widget {

setup_add_new_button() {
this.add_new_button = $(
`<div class="add-new btn btn-xs pull-right" title="${__(
"Add New " + this.document_type
)}">
`<div class="add-new btn btn-xs pull-right"
title="${__("Add New")} ${__(this.document_type)}
">
${frappe.utils.icon("add", "sm")}
</div>`
);
@@ -99,7 +99,7 @@ export default class QuickListWidget extends Widget {
];
let me = this;
this.dialog = new frappe.ui.Dialog({
title: __("Set Filters for {0}", [this.document_type]),
title: __("Set Filters for {0}", [__(this.document_type)]),
fields: fields,
primary_action: function () {
let old_filter = me.quick_list_filter;
@@ -114,7 +114,7 @@ export default class QuickListWidget extends Widget {
me.set_body();
}
},
primary_action_label: "Set",
primary_action_label: __("Set"),
});

this.dialog.show();
@@ -243,7 +243,7 @@ export default class QuickListWidget extends Widget {
}
let route = frappe.utils.generate_route({ type: "doctype", name: this.document_type });
this.see_all_button = $(`
<a href="${route}"class="see-all btn btn-xs">View List</a>
<a href="${route}"class="see-all btn btn-xs">${__("View List")}</a>
`).appendTo(this.footer);
}
}

+ 5
- 5
frappe/public/js/frappe/widgets/widget_dialog.js Целия файл

@@ -272,7 +272,7 @@ class CardDialog extends WidgetDialog {
{
fieldname: "only_for",
fieldtype: "Link",
label: "Only for ",
label: "Only for",
options: "Country",
},
{
@@ -296,18 +296,18 @@ class CardDialog extends WidgetDialog {
let message = "";

if (!data.links) {
message = "You must add atleast one link.";
message = __("You must add atleast one link.");
} else {
data.links.map((item, idx) => {
let row = idx + 1;

if (!item.link_type) {
message = "Following fields have missing values: <br><br><ul>";
message += `<li>Link Type in Row ${row}</li>`;
message = __("Following fields have missing values") + ": <br><br><ul>";
message += `<li>${__("Link Type in Row")} ${row}</li>`;
}

if (!item.link_to) {
message += `<li>Link To in Row ${row}</li>`;
message += `<li>${__("Link To in Row")} ${row}</li>`;
}

item.label = item.label ? item.label : item.link_to;


Зареждане…
Отказ
Запис