Skip to content

Commit 833316f

Browse files
Kranthi Kumar MuppalaPaperclip-Paperclip
authored andcommitted
fix(i18n): localize remaining UI strings - CommandDialog, ToolOptions, schema labels
- Add dialogTitle/dialogDescription props to CommandDialog for translated screen-reader text - Extract "Options" and "No configurable options" strings in ToolOptions to i18n - Convert camelCase Zod field keys to Title Case for readable fallback labels - Add translations for 5 new keys across all 11 locales Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 parent 7cbdd6d commit 833316f

15 files changed

Lines changed: 115 additions & 20 deletions

File tree

apps/web/components/search/search-command.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ export function SearchCommand({
163163
);
164164

165165
return (
166-
<CommandDialog open={open} onOpenChange={handleOpenChange}>
166+
<CommandDialog
167+
open={open}
168+
onOpenChange={handleOpenChange}
169+
dialogTitle={t("dialogTitle")}
170+
dialogDescription={t("dialogDescription")}
171+
>
167172
<CommandInput
168173
placeholder={t("placeholder")}
169174
value={query}

apps/web/components/tools/schema-field-renderer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export function SchemaFieldRenderer({
7272
idPrefix = "",
7373
onChange,
7474
}: SchemaFieldRendererProps): React.ReactElement {
75-
const label = field.title ?? fieldKey;
75+
const label =
76+
field.title ??
77+
fieldKey
78+
.replace(/([a-z])([A-Z])/g, "$1 $2")
79+
.replace(/^./, (c) => c.toUpperCase());
7680
const description = field.description;
7781
const id = `${idPrefix}${fieldKey}`;
7882

apps/web/components/tools/tool-options.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useCallback, useMemo } from "react";
44
import { Settings2 } from "lucide-react";
5+
import { useTranslations } from "next-intl";
56
import type { SchemaField } from "./schema-field-renderer";
67
import { SchemaFieldRenderer } from "./schema-field-renderer";
78
import { cn } from "@/lib/utils";
@@ -53,6 +54,7 @@ export function ToolOptions<
5354
showHeader = true,
5455
className,
5556
}: ToolOptionsProps<T>): React.ReactElement {
57+
const t = useTranslations("tools.options");
5658
const updateValue = useCallback(
5759
(key: string, value: unknown) => {
5860
onChange({ ...values, [key]: value } as T);
@@ -71,9 +73,7 @@ export function ToolOptions<
7173

7274
if (fields.length === 0) {
7375
return (
74-
<p className="text-muted-foreground text-sm">
75-
No configurable options for this tool.
76-
</p>
76+
<p className="text-muted-foreground text-sm">{t("noConfigurable")}</p>
7777
);
7878
}
7979

@@ -82,7 +82,7 @@ export function ToolOptions<
8282
{showHeader && (
8383
<div className="text-muted-foreground flex items-center gap-2 text-sm font-medium">
8484
<Settings2 className="h-4 w-4" />
85-
<span>Options</span>
85+
<span>{t("title")}</span>
8686
</div>
8787
)}
8888
<div className="space-y-4">

apps/web/components/ui/command.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,25 @@ const Command = React.forwardRef<
2828
));
2929
Command.displayName = CommandPrimitive.displayName;
3030

31+
interface CommandDialogProps extends DialogProps {
32+
dialogTitle?: string;
33+
dialogDescription?: string;
34+
}
35+
3136
const CommandDialog = ({
3237
children,
38+
dialogTitle,
39+
dialogDescription,
3340
...props
34-
}: DialogProps): React.ReactElement => {
41+
}: CommandDialogProps): React.ReactElement => {
3542
return (
3643
<Dialog {...props}>
3744
<DialogContent className="overflow-hidden p-0 shadow-lg">
38-
<DialogTitle className="sr-only">Search tools</DialogTitle>
45+
<DialogTitle className="sr-only">
46+
{dialogTitle ?? "Search tools"}
47+
</DialogTitle>
3948
<DialogDescription className="sr-only">
40-
Search and navigate to developer tools
49+
{dialogDescription ?? "Search and navigate to developer tools"}
4150
</DialogDescription>
4251
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
4352
{children}

apps/web/messages/de.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "Kategorien",
146146
"noToolsFound": "Keine Tools gefunden.",
147147
"resultsFound": "{count, plural, one {# Ergebnis} other {# Ergebnisse}} gefunden",
148-
"noResultsFound": "Keine Tools gefunden"
148+
"noResultsFound": "Keine Tools gefunden",
149+
"placeholder": "Tools suchen...",
150+
"dialogTitle": "Tools suchen",
151+
"dialogDescription": "Entwicklertools suchen und navigieren"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "Zu Favoriten hinzufügen",
210213
"removeFavorite": "Aus Favoriten entfernen"
214+
},
215+
"options": {
216+
"title": "Optionen",
217+
"noConfigurable": "Keine konfigurierbaren Optionen für dieses Tool."
211218
}
212219
},
213220
"editor": {

apps/web/messages/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "Categories",
146146
"noToolsFound": "No tools found.",
147147
"resultsFound": "{count, plural, one {# result} other {# results}} found",
148-
"noResultsFound": "No tools found"
148+
"noResultsFound": "No tools found",
149+
"placeholder": "Search tools...",
150+
"dialogTitle": "Search tools",
151+
"dialogDescription": "Search and navigate to developer tools"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "Add to favorites",
210213
"removeFavorite": "Remove from favorites"
214+
},
215+
"options": {
216+
"title": "Options",
217+
"noConfigurable": "No configurable options for this tool."
211218
}
212219
},
213220
"editor": {

apps/web/messages/es.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "Categorías",
146146
"noToolsFound": "No se encontraron herramientas.",
147147
"resultsFound": "{count, plural, one {# resultado} other {# resultados}} encontrado(s)",
148-
"noResultsFound": "No se encontraron herramientas"
148+
"noResultsFound": "No se encontraron herramientas",
149+
"placeholder": "Buscar herramientas...",
150+
"dialogTitle": "Buscar herramientas",
151+
"dialogDescription": "Buscar y navegar a herramientas de desarrollo"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "Agregar a favoritos",
210213
"removeFavorite": "Quitar de favoritos"
214+
},
215+
"options": {
216+
"title": "Opciones",
217+
"noConfigurable": "No hay opciones configurables para esta herramienta."
211218
}
212219
},
213220
"editor": {

apps/web/messages/fr.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "Catégories",
146146
"noToolsFound": "Aucun outil trouvé.",
147147
"resultsFound": "{count, plural, one {# résultat} other {# résultats}} trouvé(s)",
148-
"noResultsFound": "Aucun outil trouvé"
148+
"noResultsFound": "Aucun outil trouvé",
149+
"placeholder": "Rechercher des outils...",
150+
"dialogTitle": "Rechercher des outils",
151+
"dialogDescription": "Rechercher et naviguer vers les outils de développement"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "Ajouter aux favoris",
210213
"removeFavorite": "Retirer des favoris"
214+
},
215+
"options": {
216+
"title": "Options",
217+
"noConfigurable": "Aucune option configurable pour cet outil."
211218
}
212219
},
213220
"editor": {

apps/web/messages/ja.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "カテゴリ",
146146
"noToolsFound": "ツールが見つかりません。",
147147
"resultsFound": "{count, plural, one {# 件} other {# 件}}の結果が見つかりました",
148-
"noResultsFound": "ツールが見つかりません"
148+
"noResultsFound": "ツールが見つかりません",
149+
"placeholder": "ツールを検索...",
150+
"dialogTitle": "ツールを検索",
151+
"dialogDescription": "開発ツールを検索してナビゲート"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "お気に入りに追加",
210213
"removeFavorite": "お気に入りから削除"
214+
},
215+
"options": {
216+
"title": "オプション",
217+
"noConfigurable": "このツールには設定可能なオプションはありません。"
211218
}
212219
},
213220
"editor": {

apps/web/messages/ko.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"categories": "카테고리",
146146
"noToolsFound": "도구를 찾을 수 없습니다.",
147147
"resultsFound": "{count, plural, one {# 결과} other {# 결과}} 찾음",
148-
"noResultsFound": "도구를 찾을 수 없음"
148+
"noResultsFound": "도구를 찾을 수 없음",
149+
"placeholder": "도구 검색...",
150+
"dialogTitle": "도구 검색",
151+
"dialogDescription": "개발 도구를 검색하고 이동"
149152
},
150153
"categories": {
151154
"categoryNotFound": {
@@ -208,6 +211,10 @@
208211
"toolCard": {
209212
"addFavorite": "즐겨찾기에 추가",
210213
"removeFavorite": "즐겨찾기에서 제거"
214+
},
215+
"options": {
216+
"title": "옵션",
217+
"noConfigurable": "이 도구에는 구성 가능한 옵션이 없습니다."
211218
}
212219
},
213220
"editor": {

0 commit comments

Comments
 (0)