From e5088d06e8e89c16c05a91b8949f2f584873a7db Mon Sep 17 00:00:00 2001 From: hugo Date: Sat, 21 Feb 2026 13:24:03 +0100 Subject: [PATCH] chore: even more i18n and no end in sight --- .../ImportAnalysisView/ImportAnalysisView.tsx | 50 ++++++++++++------- .../components/SettingsView/SettingsView.tsx | 40 +++++++-------- src/renderer/i18n/locales/de.json | 38 +++++++++++++- src/renderer/i18n/locales/en.json | 38 +++++++++++++- src/renderer/i18n/locales/es.json | 38 +++++++++++++- src/renderer/i18n/locales/fr.json | 38 +++++++++++++- src/renderer/i18n/locales/it.json | 38 +++++++++++++- .../hardcodedUiLiteralsPhase1.test.ts | 25 +++++++++- 8 files changed, 262 insertions(+), 43 deletions(-) diff --git a/src/renderer/components/ImportAnalysisView/ImportAnalysisView.tsx b/src/renderer/components/ImportAnalysisView/ImportAnalysisView.tsx index 8d1b674..01c5fd4 100644 --- a/src/renderer/components/ImportAnalysisView/ImportAnalysisView.tsx +++ b/src/renderer/components/ImportAnalysisView/ImportAnalysisView.tsx @@ -1245,6 +1245,7 @@ const TaxonomySection: React.FC<{ onMappingsAnalyzed: (categoryMappings: Record, tagMappings: Record) => void; onMappingUpdated: (type: 'category' | 'tag', itemName: string, mappedTo: string | undefined) => void; }> = ({ categories, tags, expanded, onToggle, onMappingsAnalyzed, onMappingUpdated }) => { + const { t } = useI18n(); const [isAnalyzing, setIsAnalyzing] = useState(false); const [showModelSelector, setShowModelSelector] = useState(false); const [availableModels, setAvailableModels] = useState([]); @@ -1335,10 +1336,10 @@ const TaxonomySection: React.FC<{

- Categories & Tags + {t('importAnalysis.taxonomyTitle')} {(mappedCategoriesCount > 0 || mappedTagsCount > 0) && ( - {mappedCategoriesCount + mappedTagsCount} mapped + {t('importAnalysis.mappedCount', { count: mappedCategoriesCount + mappedTagsCount })} )}

@@ -1354,14 +1355,14 @@ const TaxonomySection: React.FC<{ {isAnalyzing ? ( <> - Analyzing... + {t('importAnalysis.analyzing')} ) : ( <> - Analyze with... + {t('importAnalysis.analyzeWith')} @@ -1383,14 +1384,14 @@ const TaxonomySection: React.FC<{ )}
- AI will suggest mappings from new to existing items to avoid duplicates + {t('importAnalysis.aiMappingHint')} {categories.length > 0 && (
- Categories + {t('importAnalysis.categories')}
{categories.map((cat, idx) => ( @@ -1414,7 +1415,7 @@ const TaxonomySection: React.FC<{ {tags.length > 0 && (
- Tags + {t('importAnalysis.tags')}
{tags.map((tag, idx) => ( @@ -1453,6 +1454,7 @@ const TaxonomyPill: React.FC<{ onCancelEdit: () => void; onClearMapping: () => void; }> = ({ item, type: _type, isEditing, editValue, suggestions, onEditValueChange, onStartEdit, onSaveEdit, onCancelEdit, onClearMapping }) => { + const { t } = useI18n(); const inputRef = useRef(null); const dropdownRef = useRef(null); const [selectedIndex, setSelectedIndex] = useState(-1); @@ -1536,7 +1538,7 @@ const TaxonomyPill: React.FC<{ onKeyDown={handleKeyDown} onBlur={handleBlur} onFocus={() => setShowDropdown(true)} - placeholder="Map to..." + placeholder={t('importAnalysis.mapToPlaceholder')} /> {showDropdown && filteredSuggestions.length > 0 && (
@@ -1564,7 +1566,13 @@ const TaxonomyPill: React.FC<{ const className = `import-taxonomy-pill ${item.existsInProject ? 'exists' : 'new-tax'} ${hasMaping ? 'mapped' : ''}`; return ( - + {item.name} {hasMaping && ( <> @@ -1573,7 +1581,7 @@ const TaxonomyPill: React.FC<{ @@ -1592,6 +1600,7 @@ const MacrosSection: React.FC<{ expanded: boolean; onToggle: () => void; }> = ({ macros, expanded, onToggle }) => { + const { t } = useI18n(); const [expandedMacros, setExpandedMacros] = useState>(new Set()); const toggleMacro = (name: string) => { @@ -1610,11 +1619,11 @@ const MacrosSection: React.FC<{

- Macros ({macros.total}) + {t('importAnalysis.macrosWithCount', { count: macros.total })} - {macros.mappedCount} mapped + {t('importAnalysis.mappedCount', { count: macros.mappedCount })} {macros.unmappedCount > 0 && ( - {macros.unmappedCount} unmapped + {t('importAnalysis.unmappedCount', { count: macros.unmappedCount })} )}

@@ -1626,15 +1635,22 @@ const MacrosSection: React.FC<{ [{macro.name}] - {macro.mapped ? 'Mapped' : 'Unknown'} + {macro.mapped ? t('importAnalysis.macroStatusMapped') : t('importAnalysis.macroStatusUnknown')} - {macro.totalCount} uses + {t('importAnalysis.macroUses', { count: macro.totalCount })}
{expandedMacros.has(macro.name) && (
- Used in: {macro.postSlugs.slice(0, 5).join(', ')}{macro.postSlugs.length > 5 ? `, +${macro.postSlugs.length - 5} more` : ''} + + {t('importAnalysis.usedIn', { + items: macro.postSlugs.slice(0, 5).join(', '), + more: macro.postSlugs.length > 5 + ? t('importAnalysis.moreSuffix', { count: macro.postSlugs.length - 5 }) + : '', + })} +
@@ -1646,7 +1662,7 @@ const MacrosSection: React.FC<{ >
{Object.keys(usage.params).length === 0 ? ( - (no parameters) + {t('importAnalysis.noParameters')} ) : ( Object.entries(usage.params).map(([key, value]) => ( diff --git a/src/renderer/components/SettingsView/SettingsView.tsx b/src/renderer/components/SettingsView/SettingsView.tsx index 84533eb..4d554e3 100644 --- a/src/renderer/components/SettingsView/SettingsView.tsx +++ b/src/renderer/components/SettingsView/SettingsView.tsx @@ -329,7 +329,7 @@ export const SettingsView: React.FC = () => { }; const handleBrowseDataPath = async () => { - const selected = await window.electronAPI?.app.selectFolder('Select Project Data Folder'); + const selected = await window.electronAPI?.app.selectFolder(t('settings.project.selectDataFolder')); if (selected) { setProjectDataPath(selected); } @@ -668,7 +668,7 @@ export const SettingsView: React.FC = () => {