fix(ui): replace all hardcoded frontend strings with i18n translation keys#9013
Open
Pfannkuchensack wants to merge 2 commits intoinvoke-ai:mainfrom
Open
fix(ui): replace all hardcoded frontend strings with i18n translation keys#9013Pfannkuchensack wants to merge 2 commits intoinvoke-ai:mainfrom
Pfannkuchensack wants to merge 2 commits intoinvoke-ai:mainfrom
Conversation
… keys Remove fallback/defaultValue strings from t() calls, replace hardcoded English text in labels, tooltips, aria-labels, placeholders and JSX content with proper t() calls, and add ~50 missing keys to en.json. Fix incorrect i18n key paths in CanvasObjectImage.ts and a Zoom button aria-label bug in CanvasToolbarScale.tsx.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove fallback/defaultValue strings from
t()calls, replace hardcoded English text in labels, tooltips, aria-labels, placeholders and JSX content with propert()calls, and add ~50 missing keys toen.json. Fix incorrect i18n key paths inCanvasObjectImage.tsand a Zoom button aria-label bug inCanvasToolbarScale.tsx.Related Issues / Discussions
Frontend components added by recent AI-written PRs introduced hardcoded English strings and
t()fallback values instead of using proper i18n localization entries. This PR ensures all user-facing frontend text goes through the translation system.What was fixed
Issue 1:
t()calls with fallback/default values (54 occurrences across 12 files)These used patterns like
t('key', 'Fallback')ort('key', { defaultValue: 'Text' }), bypassing the localization file:TextToolOptions.tsxt('controlLayers.text.bold', { defaultValue: 'Bold' })CanvasObjectImage.tst('common.loadingImage', 'Loading Image')ModelList.tsxt('modelManager.modelsDeleted', { defaultValue: '...' })PinnedFillColorPickerOverlay.tsxt('controlLayers.fill.switchColors', { defaultValue: '...' })ToolGradientModeToggle.tsxt('controlLayers.gradient.linear', { defaultValue: 'Linear' })Issue 2: Hardcoded strings without
t()(~100 occurrences across ~35 files)<Button>Fit View</Button>,<Text>No images found</Text>label="..."propslabel="Loading",label="Queue Item"aria-label="..."propsaria-label="Upload image",aria-label="Zoom out"tooltip="..."propstooltip="Image Actions",tooltip="Prompt History"placeholder="..."propsplaceholder="Search..."title="..."/ JSX headers<ModalHeader>Crop Image</ModalHeader>Issue 3: Wrong i18n key paths (2 occurrences)
In
CanvasObjectImage.ts, the keyscontrolLayers.unableToFindImageandcontrolLayers.unableToLoadImagewere used, but the actual keys inen.jsonare undercontrolLayers.errors.*. The fallback strings masked this bug — translations would have never worked.Bonus: Bug fix
In
CanvasToolbarScale.tsx, the Zoom In button (withPiMagnifyingGlassPlusBoldicon) hadaria-label="Zoom out"— fixed to"Zoom in".New
en.jsonkeys added (~50)commoneditName,fitView,json,minimize,next,noMatchingItems,notifications,openSlider,previous,removeFromCollection,resetView,saveToAssets,settings,toggleRgbHex,zoomIn,zoomOutpromptpromptHistory,clearHistory,usePrompt,searchPromptsgallerybulkDownloadReady,clickToDownload,loadingGallery,loadingMetadata,noImagesFoundqueuequeueActionsMenu,queueItemcontrolLayersdisableReferenceImage,enableReferenceImage,invalidReferenceImage,invertRegion,removeImageFromCollection,selectRefImagecontrolLayers.textlineHeight,lineHeightDense,lineHeightNormal,lineHeightSpaciouscontrolLayers.fillswitchColorscontrolLayers.autoSwitchdoNotAutoSwitch,switchOnStartDesc,switchOnFinishDescnodesnodeDataworkflowsnoWorkflowToSaveloraremoveLoRAdynamicPromptsproblemGeneratingPromptsmodelManagerdeleteModelsConfirm,deleteWarning,modelsDeleted,modelsDeleteFailed,someModelsFailedToDelete,modelsDeletedPartial,someModelsDeleted,modelsDeleteErrorcropper(new)cropImage,aspectRatio,free,mouseWheelZoom,spaceDragPan,dragCropBoxToAdjustsupportVideosgettingStartedPlaylist,studioSessionsPlaylist,discord,githubused regex
Pattern A: t('key', 'fallback')
rg "t('[^']+',\s*'" --glob '*.{ts,tsx}' src/
Pattern B: t('key', { defaultValue: '...' })
rg "t([^)]defaultValue" --glob '.{ts,tsx}' src/
label="..." props with English text
rg 'label="[A-Z][^"]"' --glob '.tsx' src/ --glob '!.test.'
tooltip="..." props
rg 'tooltip="[A-Z][^"]"' --glob '.tsx' src/ --glob '!.test.'
aria-label="..." props
rg 'aria-label="[A-Z][^"]"' --glob '.tsx' src/ --glob '!.test.'
placeholder="..." props with English text
rg 'placeholder="[A-Z][^"]"' --glob '.tsx' src/ --glob '!.test.'
Hardcoded text in JSX tags (z.B. >Some Text<)
rg '>[A-Z][A-Za-z ]{2,}</' --glob '.tsx' src/ --glob '!.test.*'
QA Instructions
Merge Plan
No special merge considerations. Localization-only change with no runtime behavior changes beyond fixing the Zoom button aria-label and the
CanvasObjectImagekey paths.Checklist
What's Newcopy (if doing a release after this PR) — N/A