fix(ui): fix tab translations

model manager was using the wrong key due to the tabs render func subbing values in. made translation key a prop of a tab item.
This commit is contained in:
psychedelicious 2023-07-08 23:48:32 +10:00 committed by Kent Keirsey
parent 0f33a98e95
commit 81817532f8

View File

@ -41,6 +41,7 @@ import UnifiedCanvasTab from './tabs/UnifiedCanvas/UnifiedCanvasTab';
export interface InvokeTabInfo { export interface InvokeTabInfo {
id: InvokeTabName; id: InvokeTabName;
translationKey: string;
icon: ReactNode; icon: ReactNode;
content: ReactNode; content: ReactNode;
} }
@ -48,26 +49,31 @@ export interface InvokeTabInfo {
const tabs: InvokeTabInfo[] = [ const tabs: InvokeTabInfo[] = [
{ {
id: 'txt2img', id: 'txt2img',
translationKey: 'common.txt2img',
icon: <Icon as={FaFont} sx={{ boxSize: 6, pointerEvents: 'none' }} />, icon: <Icon as={FaFont} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <TextToImageTab />, content: <TextToImageTab />,
}, },
{ {
id: 'img2img', id: 'img2img',
translationKey: 'common.img2img',
icon: <Icon as={FaImage} sx={{ boxSize: 6, pointerEvents: 'none' }} />, icon: <Icon as={FaImage} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <ImageTab />, content: <ImageTab />,
}, },
{ {
id: 'unifiedCanvas', id: 'unifiedCanvas',
translationKey: 'common.unifiedCanvas',
icon: <Icon as={MdGridOn} sx={{ boxSize: 6, pointerEvents: 'none' }} />, icon: <Icon as={MdGridOn} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <UnifiedCanvasTab />, content: <UnifiedCanvasTab />,
}, },
{ {
id: 'nodes', id: 'nodes',
translationKey: 'common.nodes',
icon: <Icon as={MdDeviceHub} sx={{ boxSize: 6, pointerEvents: 'none' }} />, icon: <Icon as={MdDeviceHub} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <NodesTab />, content: <NodesTab />,
}, },
{ {
id: 'modelManager', id: 'modelManager',
translationKey: 'modelManager.modelManager',
icon: <Icon as={FaCube} sx={{ boxSize: 6, pointerEvents: 'none' }} />, icon: <Icon as={FaCube} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <ModelManagerTab />, content: <ModelManagerTab />,
}, },
@ -146,12 +152,12 @@ const InvokeTabs = () => {
<Tooltip <Tooltip
key={tab.id} key={tab.id}
hasArrow hasArrow
label={String(t(`common.${tab.id}` as ResourceKey))} label={String(t(tab.translationKey as ResourceKey))}
placement="end" placement="end"
> >
<Tab onClick={handleClickTab}> <Tab onClick={handleClickTab}>
<VisuallyHidden> <VisuallyHidden>
{String(t(`common.${tab.id}` as ResourceKey))} {String(t(tab.translationKey as ResourceKey))}
</VisuallyHidden> </VisuallyHidden>
{tab.icon} {tab.icon}
</Tab> </Tab>