Only check required field when i18n dialog is open.

Fixes #41271
Fixes #41270

Signed-off-by: Stan Silvert <ssilvert@redhat.com>
This commit is contained in:
Stan Silvert 2025-10-28 14:47:26 -04:00 committed by Pedro Igor
parent 6bce46c842
commit 322cbcdd84

View File

@ -74,14 +74,6 @@ function hasTranslation(value: string, t: TFunction) {
return t(value) === value && value !== "";
}
function isTranslationRequired(
value: string,
t: TFunction,
realm?: RealmRepresentation,
) {
return realm?.internationalizationEnabled && hasTranslation(value, t);
}
export const TranslatableField = ({
attributeName,
prefix,
@ -108,6 +100,16 @@ export const TranslatableField = ({
}
}, [value]);
function isTranslationRequired(
value: string,
t: TFunction,
realm?: RealmRepresentation,
) {
return (
realm?.internationalizationEnabled && open && hasTranslation(value, t)
);
}
return (
<>
{isTranslationRequired(value, t, realm) && (