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: Translate UI #200

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
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
102 changes: 51 additions & 51 deletions print_designer/public/js/print_designer/PropertiesPanelState.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Page Settings",
title: __("Page Settings"),
sectionCondtional: () =>
!MainStore.getCurrentElementsId.length && MainStore.activeControl === "mouse-pointer",
fields: [
{
label: () => `Select ${MainStore.rawMeta?.name || "Document"}`,
label: () => __(`Select ${MainStore.rawMeta?.name || "Document"}`),
isLabelled: true,
name: "documentName",
condtional: () => !!MainStore.currentDoc,
Expand All @@ -328,7 +328,7 @@ export const createPropertiesPanel = () => {
},
},
{
label: "Page Size",
label: __("Page Size"),
name: "pageSize",
isLabelled: true,
condtional: null,
Expand Down Expand Up @@ -364,7 +364,7 @@ export const createPropertiesPanel = () => {
},
},
{
label: "Page UOM",
label: __("Page UOM"),
name: "pageUom",
isLabelled: true,
condtional: null,
Expand All @@ -377,39 +377,39 @@ export const createPropertiesPanel = () => {
fieldtype: "Autocomplete",
requiredData: () => page.value.UOM,
options: () => [
{ label: "Pixels (px)", value: "px" },
{ label: "Milimeter (mm)", value: "mm" },
{ label: "Centimeter (cm)", value: "cm" },
{ label: "Inch (in)", value: "in" },
{ label: __("Pixels (px))"), value: "px" },
{ label:__("Milimeter (mm)"), value: "mm" },
{ label: __("Centimeter (cm)"), value: "cm" },
{ label: __("Inch (in)"), value: "in" },
],
reactiveObject: page,
propertyName: "UOM",
});
},
},
[
pageInput("Height", "page_height", "height", { parentBorderTop: true }),
pageInput("Width", "page_width", "width"),
pageInput(__("Height"), "page_height", "height", { parentBorderTop: true }),
pageInput(__("Width"), "page_width", "width"),
],
],
});
MainStore.propertiesPanel.push({
title: "Page Margins",
title: __("Page Margins"),
sectionCondtional: () =>
!MainStore.getCurrentElementsId.length && MainStore.activeControl === "mouse-pointer",
fields: [
[
pageInput("Top", "page_top", "marginTop"),
pageInput("Bottom", "page_bottom", "marginBottom"),
pageInput(__("Top"), "page_top", "marginTop"),
pageInput(__("Bottom"), "page_bottom", "marginBottom"),
],
[
pageInput("Left", "page_left", "marginLeft"),
pageInput("Right", "page_right", "marginRight"),
pageInput(__("Left"), "page_left", "marginLeft"),
pageInput(__("Right"), "page_right", "marginRight"),
],
],
});
MainStore.propertiesPanel.push({
title: "PDF Settings",
title: __("PDF Settings"),
sectionCondtional: () =>
MainStore.mode == "pdfSetup" &&
!MainStore.getCurrentElementsId.length &&
Expand All @@ -422,7 +422,7 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Transform",
title: __("Transform"),
sectionCondtional: () => MainStore.getCurrentElementsId.length === 1,
fields: [
[
Expand All @@ -436,14 +436,14 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Table Settings",
title: __("Table Settings"),
sectionCondtional: () =>
MainStore.getCurrentElementsId.length === 1 &&
MainStore.getCurrentElementsValues[0]?.type == "table",
fields: [
[
{
label: "Current Table",
label: __("Current Table"),
name: "table",
isLabelled: true,
labelDirection: "column",
Expand Down Expand Up @@ -485,7 +485,7 @@ export const createPropertiesPanel = () => {
},
},
{
label: "Rows",
label: __("Rows"),
name: "no_of_rows",
isLabelled: true,
labelDirection: "column",
Expand Down Expand Up @@ -517,7 +517,7 @@ export const createPropertiesPanel = () => {
],
[
{
label: "Set as Primary Table",
label: __("Set as Primary Table"),
name: "isPrimaryTable",
isLabelled: true,
labelDirection: "column",
Expand All @@ -534,8 +534,8 @@ export const createPropertiesPanel = () => {
propertyName: "isPrimaryTable",
isStyle: false,
options: () => [
{ label: "Yes", value: "Yes" },
{ label: "No", value: "No" },
{ label: __("Yes"), value: "Yes" },
{ label: __("No"), value: "No" },
],
formatValue: (object, property, isStyle) => {
if (!object) return;
Expand All @@ -558,7 +558,7 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Rectangle Settings",
title: __("Rectangle Settings"),
sectionCondtional: () =>
MainStore.getCurrentElementsId.length === 1 &&
MainStore.getCurrentElementsValues[0]?.type == "rectangle",
Expand All @@ -567,15 +567,15 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Enable Jinja Parsing",
title: __("Enable Jinja Parsing"),
sectionCondtional: () =>
MainStore.getCurrentElementsId.length === 1 &&
MainStore.getCurrentElementsValues[0].type === "text" &&
!MainStore.getCurrentElementsValues[0].isDynamic,
fields: [
[
{
label: "Render Jinja",
label: __("Render Jinja"),
name: "parseJinja",
labelDirection: "column",
condtional: () =>
Expand All @@ -590,8 +590,8 @@ export const createPropertiesPanel = () => {
fieldtype: "Select",
requiredData: [MainStore.getCurrentElementsValues[0]],
options: () => [
{ label: "Yes", value: "Yes" },
{ label: "No", value: "No" },
{ label: __("Yes"), value: "Yes" },
{ label: __("No"), value: "No" },
],
formatValue: (object, property, isStyle) => {
if (!object) return;
Expand All @@ -613,12 +613,12 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Text Tool",
title: __("Text Tool"),
sectionCondtional: () => MainStore.activeControl === "text",
fields: [
[
{
label: "Text Control :",
label: __("Text Control :"),
name: "textControlType",
labelDirection: "column",
condtional: () => MainStore.activeControl === "text",
Expand All @@ -630,8 +630,8 @@ export const createPropertiesPanel = () => {
fieldtype: "Select",
requiredData: [MainStore],
options: () => [
{ label: "Dynamic Text", value: "dynamic" },
{ label: "Static Text", value: "static" },
{ label: __("Dynamic Text"), value: "dynamic" },
{ label: __("Static Text"), value: "static" },
],
reactiveObject: MainStore,
propertyName: "textControlType",
Expand All @@ -642,7 +642,7 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Font Settings",
title: __("Font Settings"),
sectionCondtional: () =>
(MainStore.getCurrentElementsId.length === 1 &&
["text", "table"].indexOf(MainStore.getCurrentElementsValues[0]?.type) != -1) ||
Expand All @@ -651,7 +651,7 @@ export const createPropertiesPanel = () => {
fields: [
[
{
label: "Choose Element :",
label: __("Choose Element :"),
name: "styleEditMode",
labelDirection: "column",
condtional: null,
Expand All @@ -668,9 +668,9 @@ export const createPropertiesPanel = () => {
"table" == MainStore.activeControl
)
return [
{ label: "Label Element", value: "label" },
{ label: "Main Element", value: "main" },
{ label: "Header Element", value: "header" },
{ label: __("Label Element"), value: "label" },
{ label: __("Main Element"), value: "main" },
{ label: __("Header Element"), value: "header" },
];
if (
("text" == MainStore.getCurrentElementsValues[0]?.type &&
Expand All @@ -679,10 +679,10 @@ export const createPropertiesPanel = () => {
MainStore.textControlType == "static")
)
return [
{ label: "Label Element", value: "label" },
{ label: "Main Element", value: "main" },
{ label: __("Label Element"), value: "label" },
{ label: __("Main Element"), value: "main" },
];
return [{ label: "Main Element", value: "main" }];
return [{ label: __("Main Element"), value: "main" }];
},
reactiveObject: () => {
let styleClass = "table";
Expand Down Expand Up @@ -724,7 +724,7 @@ export const createPropertiesPanel = () => {
],
[
{
label: "Label Style :",
label: __("Label Style :"),
name: "labelDisplayOptions",
labelDirection: "column",
condtional: () => {
Expand Down Expand Up @@ -756,9 +756,9 @@ export const createPropertiesPanel = () => {
requiredData: [MainStore],
options: () => {
return [
{ label: "Inline", value: "standard" },
{ label: "Row", value: "flexDynamicText" },
{ label: "Column", value: "flexDirectionColumn" },
{ label: __("Inline"), value: "standard" },
{ label: __("Row"), value: "flexDynamicText" },
{ label: __("Column"), value: "flexDirectionColumn" },
];
},
reactiveObject: () => {
Expand Down Expand Up @@ -808,7 +808,7 @@ export const createPropertiesPanel = () => {
],
[
{
label: "Font",
label: __("Font"),
name: "googleFonts",
isLabelled: true,
labelDirection: "column",
Expand Down Expand Up @@ -847,7 +847,7 @@ export const createPropertiesPanel = () => {
},
},
{
label: "Weight",
label: __("Weight"),
name: "fontWeight",
isLabelled: true,
labelDirection: "column",
Expand Down Expand Up @@ -985,7 +985,7 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Border",
title: __("Border"),
sectionCondtional: () => MainStore.getCurrentElementsId.length === 1,
fields: [
[
Expand All @@ -1008,7 +1008,7 @@ export const createPropertiesPanel = () => {
borderWidthIcons("borderBottomStyle"),
],
{
label: "Border Color",
label: __("Border Color"),
name: "borderColor",
labelDirection: "column",
isLabelled: true,
Expand Down Expand Up @@ -1036,7 +1036,7 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Padding",
title: __("Padding"),
sectionCondtional: () =>
MainStore.getCurrentElementsId.length === 1 &&
["text", "image", "table"].indexOf(MainStore.getCurrentElementsValues[0].type) !== -1,
Expand All @@ -1052,14 +1052,14 @@ export const createPropertiesPanel = () => {
],
});
MainStore.propertiesPanel.push({
title: "Barcode Settings",
title: __("Barcode Settings"),
sectionCondtional: () =>
(!MainStore.getCurrentElementsId.length && MainStore.activeControl === "barcode") ||
(MainStore.getCurrentElementsId.length === 1 &&
MainStore.getCurrentElementsValues[0].type === "barcode"),
fields: [
{
label: "Barcode Format",
label: __("Barcode Format"),
name: "barcodeFormat",
isLabelled: true,
condtional: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="fallback-image" v-else>
<div class="content">
<span v-if="width >= 100 || height >= 100"
>Please Double click to select Barcode</span
>{{ __("Please Double click to select Barcode") }}</span
>
</div>
</div>
Expand Down Expand Up @@ -98,13 +98,13 @@ const parseJinja = async () => {
if (result.success) {
return result.message;
} else {
console.error("Error From User Provided Jinja String\n\n", result.error);
console.error(__("Error From User Provided Jinja String\n\n"), result.error);
}
} catch (error) {
console.error("Error in Jinja Template\n", { value_string: content.value, error });
console.error(__("Error in Jinja Template\n"), { value_string: content.value, error });
frappe.show_alert(
{
message: "Unable Render Jinja Template. Please Check Console",
message: __("Unable Render Jinja Template. Please Check Console"),
indicator: "red",
},
5
Expand Down Expand Up @@ -145,7 +145,7 @@ watch(
});
frappe.show_alert(
{
message: "Unable Render Jinja Template. Please Check Console",
message: __("Unable Render Jinja Template. Please Check Console"),
indicator: "red",
},
5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ const parseJinja = async () => {
if (result.success) {
parsedValue.value = result.message;
} else {
console.error("Error From User Provided Jinja String\n\n", result.error);
console.error(__("Error From User Provided Jinja String\n\n"), result.error);
}
} catch (error) {
console.error("Error in Jinja Template\n", { value_string: props.field.value, error });
console.error(__("Error in Jinja Template\n"), { value_string: props.field.value, error });
frappe.show_alert(
{
message: "Unable Render Jinja Template. Please Check Console",
message: __("Unable Render Jinja Template. Please Check Console"),
indicator: "red",
},
5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
>{{ isDynamic ? "Image not Linked" : "Unable to load Image :(" }}</span
>
<span v-else-if="width >= 120 || height >= 120"
>Please Double click to select Image</span
>{{ __("Please Double click to select Image") }}</span
>
</div>
</div>
Expand Down
Loading