fix(ui): add missing translation strings

This commit is contained in:
psychedelicious 2023-10-12 22:46:47 +11:00
parent 18164fc72a
commit 89db749d89
15 changed files with 60 additions and 20 deletions

View File

@ -45,10 +45,12 @@
"accept": "Accept", "accept": "Accept",
"advanced": "Advanced", "advanced": "Advanced",
"areYouSure": "Are you sure?", "areYouSure": "Are you sure?",
"auto": "Auto",
"back": "Back", "back": "Back",
"batch": "Batch Manager", "batch": "Batch Manager",
"cancel": "Cancel", "cancel": "Cancel",
"close": "Close", "close": "Close",
"on": "On",
"communityLabel": "Community", "communityLabel": "Community",
"controlNet": "ControlNet", "controlNet": "ControlNet",
"controlAdapter": "Control Adapter", "controlAdapter": "Control Adapter",
@ -133,7 +135,8 @@
"upload": "Upload" "upload": "Upload"
}, },
"controlnet": { "controlnet": {
"controlAdapter": "Control Adapter", "controlAdapter_one": "Control Adapter",
"controlAdapter_other": "Control Adapters",
"controlnet": "$t(controlnet.controlAdapter) #{{number}} ($t(common.controlNet))", "controlnet": "$t(controlnet.controlAdapter) #{{number}} ($t(common.controlNet))",
"ip_adapter": "$t(controlnet.controlAdapter) #{{number}} ($t(common.ipAdapter))", "ip_adapter": "$t(controlnet.controlAdapter) #{{number}} ($t(common.ipAdapter))",
"t2i_adapter": "$t(controlnet.controlAdapter) #{{number}} ($t(common.t2iAdapter))", "t2i_adapter": "$t(controlnet.controlAdapter) #{{number}} ($t(common.t2iAdapter))",
@ -702,6 +705,7 @@
"vae": "VAE", "vae": "VAE",
"vaeLocation": "VAE Location", "vaeLocation": "VAE Location",
"vaeLocationValidationMsg": "Path to where your VAE is located.", "vaeLocationValidationMsg": "Path to where your VAE is located.",
"vaePrecision": "VAE Precision",
"vaeRepoID": "VAE Repo ID", "vaeRepoID": "VAE Repo ID",
"vaeRepoIDValidationMsg": "Online repository of your VAE", "vaeRepoIDValidationMsg": "Online repository of your VAE",
"variant": "Variant", "variant": "Variant",
@ -922,6 +926,7 @@
}, },
"parameters": { "parameters": {
"aspectRatio": "Aspect Ratio", "aspectRatio": "Aspect Ratio",
"aspectRatioFree": "Free",
"boundingBoxHeader": "Bounding Box", "boundingBoxHeader": "Bounding Box",
"boundingBoxHeight": "Bounding Box Height", "boundingBoxHeight": "Bounding Box Height",
"boundingBoxWidth": "Bounding Box Width", "boundingBoxWidth": "Bounding Box Width",

View File

@ -45,7 +45,7 @@ const selector = createSelector(
return { return {
activeLayerColor, activeLayerColor,
activeLayerString: layer.charAt(0).toUpperCase() + layer.slice(1), layer,
boundingBoxColor, boundingBoxColor,
boundingBoxCoordinatesString: `(${roundToHundreth( boundingBoxCoordinatesString: `(${roundToHundreth(
boxX boxX
@ -73,7 +73,7 @@ const selector = createSelector(
const IAICanvasStatusText = () => { const IAICanvasStatusText = () => {
const { const {
activeLayerColor, activeLayerColor,
activeLayerString, layer,
boundingBoxColor, boundingBoxColor,
boundingBoxCoordinatesString, boundingBoxCoordinatesString,
boundingBoxDimensionsString, boundingBoxDimensionsString,
@ -116,7 +116,9 @@ const IAICanvasStatusText = () => {
style={{ style={{
color: activeLayerColor, color: activeLayerColor,
}} }}
>{`${t('unifiedCanvas.activeLayer')}: ${activeLayerString}`}</Box> >{`${t('unifiedCanvas.activeLayer')}: ${t(
`unifiedCanvas.${layer}`
)}`}</Box>
<Box>{`${t('unifiedCanvas.canvasScale')}: ${canvasScaleString}%`}</Box> <Box>{`${t('unifiedCanvas.canvasScale')}: ${canvasScaleString}%`}</Box>
{shouldPreserveMaskedArea && ( {shouldPreserveMaskedArea && (
<Box <Box
@ -124,7 +126,7 @@ const IAICanvasStatusText = () => {
color: warningColor, color: warningColor,
}} }}
> >
Preserve Masked Area: On {t('unifiedCanvas.preserveMaskedArea')}: {t('common.on')}
</Box> </Box>
)} )}
{shouldShowBoundingBox && ( {shouldShowBoundingBox && (

View File

@ -89,7 +89,12 @@ const ControlAdaptersCollapse = () => {
} }
return ( return (
<IAICollapse label="Control Adapters" activeLabel={activeLabel}> <IAICollapse
label={t('controlnet.controlAdapter', {
count: controlAdapterIds.length,
})}
activeLabel={activeLabel}
>
<Flex sx={{ flexDir: 'column', gap: 2 }}> <Flex sx={{ flexDir: 'column', gap: 2 }}>
<ButtonGroup size="sm" w="full" justifyContent="space-between"> <ButtonGroup size="sm" w="full" justifyContent="space-between">
<IAIButton <IAIButton

View File

@ -1,7 +1,9 @@
import { Badge, Flex } from '@chakra-ui/react'; import { Badge, Flex } from '@chakra-ui/react';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const AutoAddIcon = () => { const AutoAddIcon = () => {
const { t } = useTranslation();
return ( return (
<Flex <Flex
sx={{ sx={{
@ -15,7 +17,7 @@ const AutoAddIcon = () => {
variant="solid" variant="solid"
sx={{ bg: 'accent.400', _dark: { bg: 'accent.500' } }} sx={{ bg: 'accent.400', _dark: { bg: 'accent.500' } }}
> >
auto {t('common.auto')}
</Badge> </Badge>
</Flex> </Flex>
); );

View File

@ -20,6 +20,7 @@ import BoardsList from './Boards/BoardsList/BoardsList';
import GalleryBoardName from './GalleryBoardName'; import GalleryBoardName from './GalleryBoardName';
import GallerySettingsPopover from './GallerySettingsPopover'; import GallerySettingsPopover from './GallerySettingsPopover';
import GalleryImageGrid from './ImageGrid/GalleryImageGrid'; import GalleryImageGrid from './ImageGrid/GalleryImageGrid';
import { useTranslation } from 'react-i18next';
const selector = createSelector( const selector = createSelector(
[stateSelector], [stateSelector],
@ -34,6 +35,7 @@ const selector = createSelector(
); );
const ImageGalleryContent = () => { const ImageGalleryContent = () => {
const { t } = useTranslation();
const resizeObserverRef = useRef<HTMLDivElement>(null); const resizeObserverRef = useRef<HTMLDivElement>(null);
const galleryGridRef = useRef<HTMLDivElement>(null); const galleryGridRef = useRef<HTMLDivElement>(null);
const { galleryView } = useAppSelector(selector); const { galleryView } = useAppSelector(selector);
@ -111,7 +113,7 @@ const ImageGalleryContent = () => {
leftIcon={<FaImages />} leftIcon={<FaImages />}
data-testid="images-tab" data-testid="images-tab"
> >
Images {t('gallery.images')}
</Tab> </Tab>
<Tab <Tab
as={IAIButton} as={IAIButton}
@ -124,7 +126,7 @@ const ImageGalleryContent = () => {
leftIcon={<FaServer />} leftIcon={<FaServer />}
data-testid="assets-tab" data-testid="assets-tab"
> >
Assets {t('gallery.assets')}
</Tab> </Tab>
</ButtonGroup> </ButtonGroup>
</TabList> </TabList>

View File

@ -9,6 +9,7 @@ import { memo } from 'react';
import { useFeatureStatus } from '../../system/hooks/useFeatureStatus'; import { useFeatureStatus } from '../../system/hooks/useFeatureStatus';
import ParamLoraList from './ParamLoraList'; import ParamLoraList from './ParamLoraList';
import ParamLoRASelect from './ParamLoraSelect'; import ParamLoRASelect from './ParamLoraSelect';
import { useTranslation } from 'react-i18next';
const selector = createSelector( const selector = createSelector(
stateSelector, stateSelector,
@ -22,6 +23,7 @@ const selector = createSelector(
); );
const ParamLoraCollapse = () => { const ParamLoraCollapse = () => {
const { t } = useTranslation();
const { activeLabel } = useAppSelector(selector); const { activeLabel } = useAppSelector(selector);
const isLoraEnabled = useFeatureStatus('lora').isFeatureEnabled; const isLoraEnabled = useFeatureStatus('lora').isFeatureEnabled;
@ -31,7 +33,7 @@ const ParamLoraCollapse = () => {
} }
return ( return (
<IAICollapse label="LoRA" activeLabel={activeLabel}> <IAICollapse label={t('modelManager.loraModels')} activeLabel={activeLabel}>
<Flex sx={{ flexDir: 'column', gap: 2 }}> <Flex sx={{ flexDir: 'column', gap: 2 }}>
<ParamLoRASelect /> <ParamLoRASelect />
<ParamLoraList /> <ParamLoraList />

View File

@ -6,10 +6,11 @@ import {
setAspectRatio, setAspectRatio,
setShouldLockAspectRatio, setShouldLockAspectRatio,
} from 'features/parameters/store/generationSlice'; } from 'features/parameters/store/generationSlice';
import i18next from 'i18next';
import { activeTabNameSelector } from '../../../../ui/store/uiSelectors'; import { activeTabNameSelector } from '../../../../ui/store/uiSelectors';
const aspectRatios = [ const aspectRatios = [
{ name: 'Free', value: null }, { name: i18next.t('parameters.aspectRatioFree'), value: null },
{ name: '2:3', value: 2 / 3 }, { name: '2:3', value: 2 / 3 },
{ name: '16:9', value: 16 / 9 }, { name: '16:9', value: 16 / 9 },
{ name: '1:1', value: 1 / 1 }, { name: '1:1', value: 1 / 1 },

View File

@ -7,6 +7,7 @@ import IAIMantineSelect from 'common/components/IAIMantineSelect';
import { vaePrecisionChanged } from 'features/parameters/store/generationSlice'; import { vaePrecisionChanged } from 'features/parameters/store/generationSlice';
import { PrecisionParam } from 'features/parameters/types/parameterSchemas'; import { PrecisionParam } from 'features/parameters/types/parameterSchemas';
import { memo, useCallback } from 'react'; import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
const selector = createSelector( const selector = createSelector(
stateSelector, stateSelector,
@ -20,6 +21,7 @@ const selector = createSelector(
const DATA = ['fp16', 'fp32']; const DATA = ['fp16', 'fp32'];
const ParamVAEModelSelect = () => { const ParamVAEModelSelect = () => {
const { t } = useTranslation();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { vaePrecision } = useAppSelector(selector); const { vaePrecision } = useAppSelector(selector);
@ -37,7 +39,7 @@ const ParamVAEModelSelect = () => {
return ( return (
<IAIInformationalPopover feature="paramVAEPrecision"> <IAIInformationalPopover feature="paramVAEPrecision">
<IAIMantineSelect <IAIMantineSelect
label="VAE Precision" label={t('modelManager.vaePrecision')}
value={vaePrecision} value={vaePrecision}
data={DATA} data={DATA}
onChange={handleChange} onChange={handleChange}

View File

@ -60,9 +60,9 @@ const QueueButtonTooltipContent = ({ prepend = false }: Props) => {
)} )}
<StyledDivider /> <StyledDivider />
<Text fontWeight={400} fontStyle="oblique 10deg"> <Text fontWeight={400} fontStyle="oblique 10deg">
Adding images to{' '} {t('parameters.invoke.addingImagesTo')}{' '}
<Text as="span" fontWeight={600}> <Text as="span" fontWeight={600}>
{autoAddBoardName || 'Uncategorized'} {autoAddBoardName || t('boards.uncategorized')}
</Text> </Text>
</Text> </Text>
</Flex> </Flex>

View File

@ -14,6 +14,7 @@ import { generationSelector } from 'features/parameters/store/generationSelector
import { uiSelector } from 'features/ui/store/uiSelectors'; import { uiSelector } from 'features/ui/store/uiSelectors';
import { memo } from 'react'; import { memo } from 'react';
import ParamSDXLImg2ImgDenoisingStrength from './ParamSDXLImg2ImgDenoisingStrength'; import ParamSDXLImg2ImgDenoisingStrength from './ParamSDXLImg2ImgDenoisingStrength';
import { useTranslation } from 'react-i18next';
const selector = createSelector( const selector = createSelector(
[uiSelector, generationSelector], [uiSelector, generationSelector],
@ -29,10 +30,15 @@ const selector = createSelector(
); );
const SDXLImageToImageTabCoreParameters = () => { const SDXLImageToImageTabCoreParameters = () => {
const { t } = useTranslation();
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}> <IAICollapse
label={t('parameters.general')}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -12,6 +12,7 @@ import ParamSteps from 'features/parameters/components/Parameters/Core/ParamStep
import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull'; import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull';
import { memo } from 'react'; import { memo } from 'react';
import ParamSDXLImg2ImgDenoisingStrength from './ParamSDXLImg2ImgDenoisingStrength'; import ParamSDXLImg2ImgDenoisingStrength from './ParamSDXLImg2ImgDenoisingStrength';
import { useTranslation } from 'react-i18next';
const selector = createSelector( const selector = createSelector(
stateSelector, stateSelector,
@ -27,10 +28,15 @@ const selector = createSelector(
); );
const SDXLUnifiedCanvasTabCoreParameters = () => { const SDXLUnifiedCanvasTabCoreParameters = () => {
const { t } = useTranslation();
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}> <IAICollapse
label={t('parameters.general')}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -11,14 +11,16 @@ import ImageToImageStrength from 'features/parameters/components/Parameters/Imag
import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull'; import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull';
import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel'; import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const ImageToImageTabCoreParameters = () => { const ImageToImageTabCoreParameters = () => {
const { t } = useTranslation();
const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders); const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders);
const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel(); const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel();
return ( return (
<IAICollapse <IAICollapse
label="General" label={t('parameters.general')}
activeLabel={iterationsAndSeedLabel} activeLabel={iterationsAndSeedLabel}
defaultIsOpen={true} defaultIsOpen={true}
> >

View File

@ -9,14 +9,16 @@ import ParamSteps from 'features/parameters/components/Parameters/Core/ParamStep
import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull'; import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull';
import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel'; import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const TextToImageTabCoreParameters = () => { const TextToImageTabCoreParameters = () => {
const { t } = useTranslation();
const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders); const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders);
const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel(); const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel();
return ( return (
<IAICollapse <IAICollapse
label="General" label={t('parameters.general')}
activeLabel={iterationsAndSeedLabel} activeLabel={iterationsAndSeedLabel}
defaultIsOpen={true} defaultIsOpen={true}
> >

View File

@ -10,14 +10,16 @@ import ImageToImageStrength from 'features/parameters/components/Parameters/Imag
import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull'; import ParamSeedFull from 'features/parameters/components/Parameters/Seed/ParamSeedFull';
import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel'; import { useCoreParametersCollapseLabel } from 'features/parameters/util/useCoreParametersCollapseLabel';
import { memo } from 'react'; import { memo } from 'react';
import { useTranslation } from 'react-i18next';
const UnifiedCanvasCoreParameters = () => { const UnifiedCanvasCoreParameters = () => {
const { t } = useTranslation();
const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders); const shouldUseSliders = useAppSelector((state) => state.ui.shouldUseSliders);
const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel(); const { iterationsAndSeedLabel } = useCoreParametersCollapseLabel();
return ( return (
<IAICollapse <IAICollapse
label="General" label={t('parameters.general')}
activeLabel={iterationsAndSeedLabel} activeLabel={iterationsAndSeedLabel}
defaultIsOpen={true} defaultIsOpen={true}
> >

View File

@ -1,11 +1,12 @@
import { BoardId } from 'features/gallery/store/types'; import { BoardId } from 'features/gallery/store/types';
import { useListAllBoardsQuery } from '../endpoints/boards'; import { useListAllBoardsQuery } from '../endpoints/boards';
import { t } from 'i18next';
export const useBoardName = (board_id: BoardId) => { export const useBoardName = (board_id: BoardId) => {
const { boardName } = useListAllBoardsQuery(undefined, { const { boardName } = useListAllBoardsQuery(undefined, {
selectFromResult: ({ data }) => { selectFromResult: ({ data }) => {
const selectedBoard = data?.find((b) => b.board_id === board_id); const selectedBoard = data?.find((b) => b.board_id === board_id);
const boardName = selectedBoard?.board_name || 'Uncategorized'; const boardName = selectedBoard?.board_name || t('boards.uncategorized');
return { boardName }; return { boardName };
}, },