Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(i18n): address Copilot review — render keyed labels, un-split sentences

Juan Deniscc7178f994dd
diff --git a/frontend/src/components/QuickCreate.jsx b/frontend/src/components/QuickCreate.jsx
index 1e5e421a..4719a842 100644
--- a/frontend/src/components/QuickCreate.jsx
+++ b/frontend/src/components/QuickCreate.jsx
@@ -10,6 +10,7 @@ import {
} from '@/components/ui/dropdown-menu';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../i18n/labels';
// Global quick-create (the CRM "+" button). One entry point for every "new
// thing" flow, wherever you are. Route-based flows navigate directly; flows
@@ -54,7 +55,7 @@ export function QuickCreate({ className, variant = 'icon' }) {
{CREATE_ITEMS.map((item) => (
<DropdownMenuItem key={item.kind} onSelect={() => navigate(item.path)}>
<item.icon size={14} aria-hidden="true" />
- {t('app.quickCreate.new', 'New')} {item.label}
+ {t('app.quickCreate.new', 'New')} {translateLabel(t, item)}
</DropdownMenuItem>
))}
</DropdownMenuContent>
diff --git a/frontend/src/components/ds/ColumnsMenu.jsx b/frontend/src/components/ds/ColumnsMenu.jsx
index e4440dc5..8ff7a75a 100644
--- a/frontend/src/components/ds/ColumnsMenu.jsx
+++ b/frontend/src/components/ds/ColumnsMenu.jsx
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../../i18n/labels';
// Toolbar popover for column show/hide (datatables.net "column visibility"
// button). Lists every hideable column with an eye toggle; the trigger shows
@@ -16,7 +17,7 @@ export function ColumnsMenu({ columns = [], hiddenKeys = [], onToggle, onShowAll
const { t } = useTranslation();
const hideable = columns.filter((c) => c.hideable !== false);
const labelFor = (column) => (
- typeof column.header === 'string' && column.header ? column.header : column.key
+ typeof column.header === 'string' && column.header ? translateLabel(t, column, 'header') : column.key
);
return (
diff --git a/frontend/src/components/ds/DataTable.jsx b/frontend/src/components/ds/DataTable.jsx
index 6fa208e8..21a3f3e6 100644
--- a/frontend/src/components/ds/DataTable.jsx
+++ b/frontend/src/components/ds/DataTable.jsx
@@ -16,6 +16,7 @@ import EmptyState from '../EmptyState';
import ColumnMenu from './grid/ColumnMenu';
import { applyFilters, isDecorative, withInferredTypes } from './grid/fields';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../../i18n/labels';
/**
* Declarative data table built on top of the shadcn/ui Table primitives.
@@ -407,7 +408,7 @@ export function DataTable({
}
>
<span className="sk-dtable__head-inner">
- {column.header}
+ {typeof column.header === 'string' ? translateLabel(t, column, 'header') : column.header}
{canSort && (
<span className="sk-dtable__sort">
{isSorted && sorts[sortIndex].direction === 'asc' ? (
diff --git a/frontend/src/components/ds/GroupMenu.jsx b/frontend/src/components/ds/GroupMenu.jsx
index 93ee8e50..e8044e50 100644
--- a/frontend/src/components/ds/GroupMenu.jsx
+++ b/frontend/src/components/ds/GroupMenu.jsx
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../../i18n/labels';
// Toolbar popover for row grouping (Huly/Frappe "Group by"). Lists the
// table's groupable columns plus "No grouping"; the trigger shows the active
@@ -15,7 +16,7 @@ export function GroupMenu({ columns = [], groupBy = null, onChange, className })
if (!groupable.length) return null;
const labelFor = (column) => (
- typeof column.header === 'string' && column.header ? column.header : column.key
+ typeof column.header === 'string' && column.header ? translateLabel(t, column, 'header') : column.key
);
const active = groupable.find((c) => c.key === groupBy);
diff --git a/frontend/src/components/ds/SortChipBar.jsx b/frontend/src/components/ds/SortChipBar.jsx
index 4128f69d..9df6b98a 100644
--- a/frontend/src/components/ds/SortChipBar.jsx
+++ b/frontend/src/components/ds/SortChipBar.jsx
@@ -1,6 +1,7 @@
import { ArrowUp, ArrowDown, X } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../../i18n/labels';
// Active-sort chip bar (Twenty's EditableSortChip pattern). Renders one chip
// per sort level above the table: click the chip body to flip direction, ✕ to
@@ -16,7 +17,7 @@ export function SortChipBar({ columns = [], sorts = [], onChange, className }) {
const labelFor = (key) => {
const column = columns.find((c) => c.key === key);
if (!column) return key;
- return typeof column.header === 'string' && column.header ? column.header : column.key;
+ return typeof column.header === 'string' && column.header ? translateLabel(t, column, 'header') : column.key;
};
const flip = (key) => onChange?.(
diff --git a/frontend/src/components/ds/SortMenu.jsx b/frontend/src/components/ds/SortMenu.jsx
index 7058e3db..430887b1 100644
--- a/frontend/src/components/ds/SortMenu.jsx
+++ b/frontend/src/components/ds/SortMenu.jsx
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
+import { translateLabel } from '../../i18n/labels';
// Toolbar popover for user-controllable multi-column sorting (Frappe CRM
// style). Each active sort is a row: field label, asc/desc toggle, remove.
@@ -18,7 +19,7 @@ export function SortMenu({ columns = [], sorts = [], onChange, className }) {
const column = sortableColumns.find((c) => c.key === key);
if (!column) return key;
// Column headers may be React nodes; only plain text makes a usable label.
- return typeof column.header === 'string' ? column.header : column.key;
+ return typeof column.header === 'string' ? translateLabel(t, column, 'header') : column.key;
};
const flip = (key) => onChange?.(
diff --git a/frontend/src/components/log-viewer/LogFileList.jsx b/frontend/src/components/log-viewer/LogFileList.jsx
index ec446fcf..c9b741f9 100644
--- a/frontend/src/components/log-viewer/LogFileList.jsx
+++ b/frontend/src/components/log-viewer/LogFileList.jsx
@@ -77,7 +77,7 @@ export default function LogFileList({ files, selectedPath, onSelect, onRefresh,
</div>
) : groups.length === 0 ? (
<div className="lv-empty-hint">
- <p>{t('app.logFileList.noMatchesFor', 'No matches for "')}{query}&quot;.</p>
+ <p>{t('app.logFileList.noMatchesFor', 'No matches for "{{query}}".', { query })}</p>
</div>
) : (
groups.map((group) => {
diff --git a/frontend/src/components/settings/IconReferenceTab.jsx b/frontend/src/components/settings/IconReferenceTab.jsx
index c07f8563..d78da58e 100644
--- a/frontend/src/components/settings/IconReferenceTab.jsx
+++ b/frontend/src/components/settings/IconReferenceTab.jsx
@@ -125,7 +125,7 @@ const IconReferenceTab = () => {
{Object.keys(filteredCatalog).length === 0 && (
<div className="settings-card">
- <p style={{ textAlign: 'center', opacity: 0.5 }}>{t('app.iconReferenceTab.noIconsMatch', 'No icons match "')}{searchQuery}&quot;</p>
+ <p style={{ textAlign: 'center', opacity: 0.5 }}>{t('app.iconReferenceTab.noIconsMatch', 'No icons match "{{query}}"', { query: searchQuery })}</p>
</div>
)}
</div>
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 9129bff8..24dd706d 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -2565,10 +2565,9 @@
"when": "When"
},
"extensionBoundary": {
- "couldNotBeLoaded": "could not be loaded",
"extensionCrashed": "Extension crashed",
"itsOtherPagesAndTheRest": "Its other pages and the rest of the panel are unaffected. Try reinstalling or updating it from the Marketplace.",
- "theExtension": "The extension"
+ "theExtensionCouldNotBeLoaded": "The extension <0>{{slug}}</0> could not be loaded"
},
"extensionPermissionsDialog": {
"blocked": "Blocked",
@@ -3454,7 +3453,7 @@
"iconReference": "Icon Reference",
"iconsClickAnIconNameTo": "icons). Click an icon name to copy it.",
"lucideReactIconsAvailableInThe": "Lucide React icons available in the project (",
- "noIconsMatch": "No icons match \"",
+ "noIconsMatch": "No icons match \"{{query}}\"",
"searchIcons": "Search icons..."
},
"imagesTab": {
@@ -3791,7 +3790,7 @@
"logFileList": {
"filterLogFiles": "Filter log files…",
"noLogFilesFound": "No log files found.",
- "noMatchesFor": "No matches for \"",
+ "noMatchesFor": "No matches for \"{{query}}\".",
"reloadList": "Reload list"
},
"logHelpers": {
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index fd8a5ef5..bf6b69b6 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -2565,10 +2565,9 @@
"when": "Cuándo"
},
"extensionBoundary": {
- "couldNotBeLoaded": "no se pudo cargar",
"extensionCrashed": "La extensión falló",
"itsOtherPagesAndTheRest": "Sus otras páginas y el resto del panel no se ven afectados. Prueba a reinstalarla o actualizarla desde el Marketplace.",
- "theExtension": "La extensión"
+ "theExtensionCouldNotBeLoaded": "La extensión <0>{{slug}}</0> no se pudo cargar"
},
"extensionPermissionsDialog": {
"blocked": "Bloqueado",
@@ -3454,7 +3453,7 @@
"iconReference": "Referencia de iconos",
"iconsClickAnIconNameTo": "iconos). Haz clic en el nombre de un icono para copiarlo.",
"lucideReactIconsAvailableInThe": "Iconos de Lucide React disponibles en el proyecto (",
- "noIconsMatch": "Ningún icono coincide con \"",
+ "noIconsMatch": "Ningún icono coincide con \"{{query}}\"",
"searchIcons": "Buscar iconos..."
},
"imagesTab": {
@@ -3791,7 +3790,7 @@
"logFileList": {
"filterLogFiles": "Filtrar archivos de registro…",
"noLogFilesFound": "No se encontraron archivos de registro.",
- "noMatchesFor": "Sin coincidencias para \"",
+ "noMatchesFor": "No hay coincidencias para \"{{query}}\".",
"reloadList": "Recargar lista"
},
"logHelpers": {
diff --git a/frontend/src/plugins/runtime/ExtensionBoundary.jsx b/frontend/src/plugins/runtime/ExtensionBoundary.jsx
index 9bedf845..61a13e9c 100644
--- a/frontend/src/plugins/runtime/ExtensionBoundary.jsx
+++ b/frontend/src/plugins/runtime/ExtensionBoundary.jsx
@@ -9,7 +9,7 @@
* `getRuntimeLoadState`, with the error string in a popover (plan 32 #5).
*/
import { Component } from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
import { t } from '../../i18n/t';
// Plain (dependency-free) card so it renders even if the SDK/design-system is
@@ -24,7 +24,15 @@ export function ExtensionFailureCard({ slug, title, message }) {
{title || 'Extension failed to load'}
</h2>
<p className="sk-ext-failcard__desc">
- {t('app.extensionBoundary.theExtension', 'The extension')} <code>{slug}</code> {t('app.extensionBoundary.couldNotBeLoaded', 'could not be loaded')}
+ {/* One key with a component slot, not prefix/suffix
+ fragments: split sentences cannot be reordered by a
+ translator. */}
+ <Trans
+ i18nKey="app.extensionBoundary.theExtensionCouldNotBeLoaded"
+ defaults="The extension <0>{{slug}}</0> could not be loaded"
+ values={{ slug }}
+ components={[<code key="slug" />]}
+ />
{message ? ': ' : '.'}
{message && <span className="sk-ext-failcard__reason">{message}</span>}
</p>