diff --git a/seatunnel-ui/src/components/dynamic-form/dynamic-form-item.tsx b/seatunnel-ui/src/components/dynamic-form/dynamic-form-item.tsx index e29727fb9..969252bfc 100644 --- a/seatunnel-ui/src/components/dynamic-form/dynamic-form-item.tsx +++ b/seatunnel-ui/src/components/dynamic-form/dynamic-form-item.tsx @@ -49,7 +49,7 @@ const DynamicFormItem = defineComponent({ name: 'DynamicFormItem', props, setup(props) { - const { t } = useI18n() + const { t, te } = useI18n() if (props.locales) { useI18n().mergeLocaleMessage('zh_CN', { @@ -70,8 +70,15 @@ const DynamicFormItem = defineComponent({ return value.map((v) => field === v).indexOf(false) < 0 } + const getTranslation = (name: string, label: string, suffix: string) => { + const key = `transforms.${name.toLowerCase()}.${label}_${suffix}` + return te(key) ? t(key) : '' + } + return { t, + te, + getTranslation, formatClass, formItemDisabled } @@ -88,7 +95,7 @@ const DynamicFormItem = defineComponent({ ) : true) && ( @@ -98,7 +105,11 @@ const DynamicFormItem = defineComponent({ this.name, f.field )}`} - placeholder={f.placeholder ? this.t(f.placeholder) : ''} + placeholder={ + f.placeholder + ? (this.getTranslation(this.name, f.label, 'placeholder') || this.t(f.placeholder)) + : '' + } v-model={[(this.model as any)[f.field], 'value']} clearable={f.clearable} type={f.inputType} diff --git a/seatunnel-ui/src/locales/en_US/index.ts b/seatunnel-ui/src/locales/en_US/index.ts index 4c630c18b..2e81a36de 100644 --- a/seatunnel-ui/src/locales/en_US/index.ts +++ b/seatunnel-ui/src/locales/en_US/index.ts @@ -29,6 +29,7 @@ import project from '@/locales/en_US/project' import hook from '@/locales/en_US/hook' import common from '@/locales/en_US/common' import security from '@/locales/en_US/security' +import transforms from '@/locales/en_US/transforms' export default { security, @@ -44,5 +45,6 @@ export default { virtual_tables, theme, project, - hook + hook, + transforms } diff --git a/seatunnel-ui/src/locales/en_US/project.ts b/seatunnel-ui/src/locales/en_US/project.ts index 6327cb0f3..c3af0f871 100644 --- a/seatunnel-ui/src/locales/en_US/project.ts +++ b/seatunnel-ui/src/locales/en_US/project.ts @@ -1095,10 +1095,9 @@ export default { segmented_fields_placeholder: 'If two fields are separated, you can fill in field1, field2', copy_field: 'Copy Field', check_model: 'Please check the model information', - sql_content_label: 'sql', + sql_content_label: 'SQL', sql_content_label_placeholder: 'please input the SQL statement', query_validate: 'please input the SQL statement', - }, synchronization_instance: { pipeline_id: 'Pipeline Id', diff --git a/seatunnel-ui/src/locales/en_US/transforms.ts b/seatunnel-ui/src/locales/en_US/transforms.ts new file mode 100644 index 000000000..2d101cd72 --- /dev/null +++ b/seatunnel-ui/src/locales/en_US/transforms.ts @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + replace: { + replace_field_value: 'Replace Field', + replace_field_placeholder: 'Please enter the field to be replaced', + pattern_value: 'Pattern', + pattern_placeholder: 'Please enter the old string to be replaced', + replacement_value: 'Replacement', + replacement_placeholder: 'Please enter a new string for replacement', + is_regex_value: 'Is Regex' + }, + jsonpath: { + columns_value: 'Columns', + columns_placeholder: 'Field array that needs to be parsed', + row_error_handle_way_value: 'Row Error Handle Way' + } +} diff --git a/seatunnel-ui/src/locales/zh_CN/index.ts b/seatunnel-ui/src/locales/zh_CN/index.ts index 5379838c2..a46f901bd 100644 --- a/seatunnel-ui/src/locales/zh_CN/index.ts +++ b/seatunnel-ui/src/locales/zh_CN/index.ts @@ -29,6 +29,7 @@ import project from '@/locales/zh_CN/project' import hook from '@/locales/zh_CN/hook' import common from '@/locales/zh_CN/common' import security from '@/locales/zh_CN/security' +import transforms from '@/locales/zh_CN/transforms' export default { security, @@ -44,5 +45,6 @@ export default { virtual_tables, theme, project, - hook + hook, + transforms } diff --git a/seatunnel-ui/src/locales/zh_CN/project.ts b/seatunnel-ui/src/locales/zh_CN/project.ts index 83b98aa03..4f09acaa8 100644 --- a/seatunnel-ui/src/locales/zh_CN/project.ts +++ b/seatunnel-ui/src/locales/zh_CN/project.ts @@ -1063,9 +1063,9 @@ export default { segmented_fields_placeholder: '如分割出来两个字段,可以填写 field1, field2', copy_field: '复制字段', check_model: '请检查模型信息', - sql_content_label: 'sql', - sql_content_label_placeholder: '请输入sql语句', - query_validate: '请输入sql语句' + sql_content_label: 'SQL', + sql_content_label_placeholder: '请输入SQL语句', + query_validate: '请输入SQL语句' }, synchronization_instance: { pipeline_id: 'Pipeline ID', diff --git a/seatunnel-ui/src/locales/zh_CN/transforms.ts b/seatunnel-ui/src/locales/zh_CN/transforms.ts new file mode 100644 index 000000000..b3327f9fa --- /dev/null +++ b/seatunnel-ui/src/locales/zh_CN/transforms.ts @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + replace: { + replace_field_value: '需要替换的字段', + replace_field_placeholder: '请输入要替换的字段', + pattern_value: '将被替换的旧字符串', + pattern_placeholder: '请输入要被替换的旧字符串', + replacement_value: '用于替换的新字符串', + replacement_placeholder: '请输入用于替换的新字符串', + is_regex_value: '是否使用正则匹配' + }, + jsonpath: { + columns_value: '解析字段', + columns_placeholder: '需要解析的字段数组', + row_error_handle_way_value: '列发生错误时的处理方式' + } +}