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 form and workflow builder (backport #25482) #25547

Merged
merged 3 commits into from
Mar 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions frappe/public/js/form_builder/components/AddFieldButton.vue
Expand Up @@ -16,7 +16,7 @@
:value="autocomplete_value"
:options="fields"
@change="add_new_field"
placeholder="Search fieldtypes..."
:placeholder="__('Search fieldtypes...')"
/>
</div>
</div>
Expand Down Expand Up @@ -67,7 +67,7 @@ const fields = computed(() => {
return true;
})
.map((df) => {
let out = { label: df };
let out = { label: __(df), value: df };
return out;
});
return [...fields];
Expand Down Expand Up @@ -104,7 +104,7 @@ function toggle_fieldtype_options() {
}

function add_new_field(field) {
fieldtype = field?.label;
fieldtype = field?.value;

if (!fieldtype) return;

Expand Down
Expand Up @@ -25,7 +25,7 @@
v-slot="{ active }"
>
<li :class="['combo-box-option', active ? 'active' : '']">
{{ field.label }}
{{ __(field.label) }}
</li>
</ComboboxOption>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/form_builder/components/Column.vue
Expand Up @@ -12,7 +12,7 @@
:hidden="!column.df.label && store.read_only"
>
<div class="column-label">
<span>{{ column.df.label }}</span>
<span>{{ __(column.df.label) }}</span>
</div>
</div>
<div v-if="column.df.description" class="column-description">
Expand Down
18 changes: 9 additions & 9 deletions frappe/public/js/form_builder/components/Section.vue
Expand Up @@ -262,37 +262,37 @@ const options = computed(() => {
{
group: "Section",
items: [
{ label: "Add section below", onClick: add_section_below },
{ label: "Remove section", onClick: remove_section },
{ label: __("Add section below"), onClick: add_section_below },
{ label: __("Remove section"), onClick: remove_section },
],
},
{
group: "Column",
items: [{ label: "Add column", onClick: add_column }],
items: [{ label: __("Add column"), onClick: add_column }],
},
];

// add remove column option if there are more than one columns
if (props.section.columns.length > 1) {
groups[1].items.push({
label: "Remove column",
tooltip: "Remove last column",
label: __("Remove column"),
tooltip: __("Remove last column"),
onClick: remove_column,
});
} else if (props.section.columns[0].fields.length) {
// add remove all fields option if there is only one column and it has fields
groups[1].items.push({
label: "Empty column",
tooltip: "Remove all fields in the column",
label: __("Empty column"),
tooltip: __("Remove all fields in the column"),
onClick: () => delete_column(true),
});
}

// add move to tab option if the current section is not the first section
if (props.tab.sections.indexOf(props.section) > 0) {
groups[0].items.push({
label: "Move sections to new tab",
tooltip: "Move current and all subsequent sections to a new tab",
label: __("Move sections to new tab"),
tooltip: __("Move current and all subsequent sections to a new tab"),
onClick: move_sections_to_tab,
});
}
Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/form_builder/components/Sidebar.vue
Expand Up @@ -50,7 +50,7 @@ function resize(e) {
</button>
</div>
<div class="empty-state">
<div>Select a field to edit its properties.</div>
<div>{{ __("Select a field to edit its properties.") }}</div>
</div>
</div>
</div>
Expand Down
Expand Up @@ -22,7 +22,7 @@ let slots = useSlots();
:disabled="read_only"
@change="(event) => $emit('update:modelValue', event.target.checked)"
/>
<span class="label-area" :class="{ reqd: df.reqd }">{{ df.label }}</span>
<span class="label-area" :class="{ reqd: df.reqd }">{{ __(df.label) }}</span>
</label>

<!-- description -->
Expand Down
Expand Up @@ -29,7 +29,7 @@ if (props.df.fieldtype === "Icon") {
<slot name="label" />
<slot name="actions" />
</div>
<div v-else class="control-label label" :class="{ reqd: df.reqd }">{{ df.label }}</div>
<div v-else class="control-label label" :class="{ reqd: df.reqd }">{{ __(df.label) }}</div>

<!-- data input -->
<input
Expand Down
Expand Up @@ -36,7 +36,7 @@ let table_columns = computedAsync(async () => {
:key="i"
>
<div class="table-field ellipsis">
{{ tf.label }}
{{ __(tf.label) }}
</div>
</div>
</div>
Expand Down
Expand Up @@ -21,7 +21,7 @@ let height = computed(() => {
<slot name="label" />
<slot name="actions" />
</div>
<div v-else class="control-label label">{{ df.label }}</div>
<div v-else class="control-label label">{{ __(df.label) }}</div>

<!-- textarea input -->
<textarea
Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/form_builder/utils.js
Expand Up @@ -114,7 +114,7 @@ export async function get_table_columns(df, child_doctype) {
let total_colsize = 1;
table_columns.push([
{
label: __("No."),
label: __("No.", null, "Title of the 'row number' column"),
},
1,
]);
Expand Down
6 changes: 4 additions & 2 deletions frappe/public/js/workflow_builder/WorkflowBuilder.vue
Expand Up @@ -293,14 +293,16 @@ onMounted(() => store.fetch());
:draggable="true"
@dragstart="onDragStart"
>
Drag to add state
{{ __("Drag to add state") }}
</div>
</div>
</Panel>
<Panel :position="PanelPosition.BottomLeft">
<button class="btn btn-sm btn-default mr-2" @click="zoomIn">+</button>
<button class="btn btn-sm btn-default mr-2" @click="zoomOut">-</button>
<button class="btn btn-sm btn-default" @click="fitView()">Fit</button>
<button class="btn btn-sm btn-default" @click="fitView()">
{{ __("Fit") }}
</button>
</Panel>
<template #node-state="node">
<StateNode :node="node" />
Expand Down
Expand Up @@ -49,7 +49,7 @@ watch(

<template>
<div class="node" tabindex="0" @click.stop="store.workflow.selected = node">
<div v-if="label" class="node-label">{{ label }}</div>
<div v-if="label" class="node-label">{{ __(label) }}</div>
<div v-else class="node-placeholder text-muted">{{ __("No Label") }}</div>
<Handle
v-for="handle in ['top', 'right', 'bottom', 'left']"
Expand Down
Expand Up @@ -43,7 +43,7 @@ watch(

<template>
<div class="node" tabindex="0" @click.stop>
<div v-if="label" class="node-label">{{ label }}</div>
<div v-if="label" class="node-label">{{ __(label) }}</div>
<div v-else class="node-placeholder text-muted">{{ __("No Label") }}</div>
<Handle
v-for="handle in ['top', 'right', 'bottom', 'left']"
Expand Down
Expand Up @@ -90,7 +90,7 @@ export default {
class="access nodrag nopan"
>
<span class="mr-1" v-html="frappe.utils.icon('users', 'sm')"></span>
<span>{{ targetNode.data.allowed }}</span>
<span>{{ __(targetNode.data.allowed) }}</span>
</div>
</EdgeLabelRenderer>
</template>
Expand Down