Fix: Cross-language dropdown menu options translation error. (#17615)

This commit is contained in:
balibabu
2026-07-31 14:11:04 +08:00
committed by GitHub
parent 4b619f699b
commit b8117812e4
4 changed files with 23 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
import { crossLanguageOptions } from '@/components/cross-language-form-field';
import { useCrossLanguageOptions } from '@/components/cross-language-form-field';
import { LayoutRecognizeFormField } from '@/components/layout-recognize-form-field';
import {
SelectWithSearch,
@@ -167,6 +167,7 @@ export function RemoveHeaderFooterFormField({ prefix }: CommonProps) {
export function LanguageFormField({ prefix }: CommonProps) {
const { t } = useTranslation();
const crossLanguageOptions = useCrossLanguageOptions();
return (
<RAGFlowFormItem

View File

@@ -1,4 +1,4 @@
import { crossLanguageOptions } from '@/components/cross-language-form-field';
import { Languages } from '@/components/cross-language-form-field';
import { isEmpty } from 'lodash';
import { useEffect } from 'react';
import { useFormContext } from 'react-hook-form';
@@ -16,14 +16,10 @@ export function useSetInitialLanguage({
useEffect(() => {
if (languageShown && isEmpty(lang)) {
form.setValue(
buildFieldNameWithPrefix('lang', prefix),
crossLanguageOptions[0].value,
{
shouldValidate: true,
shouldDirty: true,
},
);
form.setValue(buildFieldNameWithPrefix('lang', prefix), Languages[0], {
shouldValidate: true,
shouldDirty: true,
});
}
}, [form, lang, languageShown, prefix]);
}