다국어 생성후 매핑 자동저장

This commit is contained in:
kjs
2026-01-14 13:26:41 +09:00
parent f9575d7b5f
commit 26bb93ab6e
6 changed files with 207 additions and 29 deletions

View File

@@ -1518,12 +1518,22 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
const updatedComponents = applyMultilangMappings(layout.components, response.data);
// 레이아웃 업데이트
setLayout((prev) => ({
...prev,
const updatedLayout = {
...layout,
components: updatedComponents,
}));
screenResolution: screenResolution,
};
setLayout(updatedLayout);
toast.success(`${response.data.length}개의 다국어 키가 생성되고 컴포넌트에 매핑되었습니다.`);
// 자동 저장 (매핑 정보가 손실되지 않도록)
try {
await screenApi.saveLayout(selectedScreen.screenId, updatedLayout);
toast.success(`${response.data.length}개의 다국어 키가 생성되고 자동 저장되었습니다.`);
} catch (saveError) {
console.error("다국어 매핑 저장 실패:", saveError);
toast.warning(`${response.data.length}개의 다국어 키가 생성되었습니다. 저장 버튼을 눌러 매핑을 저장하세요.`);
}
} else {
toast.error(response.error?.details || "다국어 키 생성에 실패했습니다.");
}
@@ -1533,7 +1543,7 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
} finally {
setIsGeneratingMultilang(false);
}
}, [selectedScreen, layout.components, menuObjid]);
}, [selectedScreen, layout, screenResolution, menuObjid]);
// 템플릿 드래그 처리
const handleTemplateDrop = useCallback(

View File

@@ -468,9 +468,17 @@ export const MultilangSettingsModal: React.FC<MultilangSettingsModalProps> = ({
addLabel(comp.id, anyComp.title, "title", parentType, parentLabel);
}
// 3. 버튼 텍스트
// 3. 버튼 텍스트 (componentId에 _button 접미사 추가하여 라벨과 구분)
if (config?.text && typeof config.text === "string") {
addLabel(comp.id, config.text, "button", parentType, parentLabel);
addLabel(
`${comp.id}_button`,
config.text,
"button",
parentType,
parentLabel,
config.langKeyId,
config.langKey
);
}
// 4. placeholder