Skip to content

Commit 9161685

Browse files
authored
Merge pull request #482 from w00fmeow/translation/fix-hardcoded-strings
fix: replace hardcoded strings with translation keys and add ICU plurals
2 parents 47e77f9 + e709476 commit 9161685

17 files changed

Lines changed: 112 additions & 45 deletions

File tree

app/_components/FeatureComponents/Checklists/Parts/Common/ChecklistHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export const ChecklistHeader = ({
194194
? [
195195
{
196196
type: "item" as const,
197-
label: "Clone",
197+
label: t("common.clone"),
198198
icon: <Copy02Icon className="h-4 w-4" />,
199199
onClick: onClone,
200200
},

app/_components/FeatureComponents/Notes/Parts/NoteEditor/NoteEditorHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export const NoteEditorHeader = ({
532532
? [
533533
{
534534
type: "item" as const,
535-
label: "Clone",
535+
label: t("common.clone"),
536536
icon: <Copy02Icon className="h-4 w-4" />,
537537
onClick: onClone,
538538
},
@@ -544,7 +544,7 @@ export const NoteEditorHeader = ({
544544
type: "item" as const,
545545
label: !isInViewMode
546546
? t("settings.view")
547-
: "Hide",
547+
: t("common.hide"),
548548
icon: !isInViewMode ? (
549549
<ViewIcon className="h-4 w-4" />
550550
) : (
@@ -604,7 +604,7 @@ export const NoteEditorHeader = ({
604604
},
605605
{
606606
type: "item" as const,
607-
label: "Print / Save as PDF",
607+
label: t("notes.printSaveAsPdf"),
608608
icon: isPrinting ? (
609609
<Orbit01Icon className="h-4 w-4 animate-spin" />
610610
) : (
@@ -624,7 +624,7 @@ export const NoteEditorHeader = ({
624624
: []),
625625
{
626626
type: "item" as const,
627-
label: "Table of Contents",
627+
label: t("notes.tableOfContents"),
628628
icon: <SidebarRightIcon className="h-4 w-4" />,
629629
onClick: () => setShowTOC(!showTOC),
630630
className: "hidden lg:flex",

app/_components/GlobalComponents/Dropdowns/DropdownMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const DropdownMenu = ({
9595
{isOpen && (
9696
<div
9797
className={cn(
98-
"absolute w-56 bg-background border border-border rounded-jotty shadow-lg z-50 py-1",
98+
"absolute min-w-56 w-fit bg-background border border-border rounded-jotty shadow-lg z-50 py-1",
9999
openUpward ? "bottom-full mb-1" : "top-full mt-1",
100100
align === "right" ? "right-0" : "left-0"
101101
)}

app/_components/GlobalComponents/Statistics/NoteFooterStats.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
"use client";
22

33
import { useMemo } from "react";
4+
import { useTranslations } from "next-intl";
45

56
interface NoteFooterStatsProps {
67
content: string;
78
}
89

910
export const NoteFooterStats = ({ content }: NoteFooterStatsProps) => {
11+
const t = useTranslations();
1012
const stats = useMemo(() => {
1113
let contentWithoutMetadata = content.replace(/^---\n[\s\S]*?\n---\n/, "");
1214

@@ -70,22 +72,9 @@ export const NoteFooterStats = ({ content }: NoteFooterStatsProps) => {
7072
return (
7173
<div className="mt-8 pt-4 border-t border-border no-print">
7274
<div className="flex flex-wrap gap-4 text-md lg:text-sm text-muted-foreground">
73-
<div className="flex items-center gap-1.5">
74-
<span className="font-medium">
75-
{stats.wordCount.toLocaleString()}
76-
</span>
77-
<span>{stats.wordCount === 1 ? "word" : "words"}</span>
78-
</div>
79-
<div className="flex items-center gap-1.5">
80-
<span className="font-medium">
81-
{stats.charCount.toLocaleString()}
82-
</span>
83-
<span>{stats.charCount === 1 ? "character" : "characters"}</span>
84-
</div>
85-
<div className="flex items-center gap-1.5">
86-
<span className="font-medium">{stats.readingTime}</span>
87-
<span>{stats.readingTime === 1 ? "minute" : "minutes"} read</span>
88-
</div>
75+
<span>{t("notes.wordCount", { count: stats.wordCount })}</span>
76+
<span>{t("notes.charCount", { count: stats.charCount })}</span>
77+
<span>{t("notes.readingTime", { count: stats.readingTime })}</span>
8978
</div>
9079
</div>
9180
);

app/_translations/de.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240
"copiedToClipboard": "In die Zwischenablage kopiert",
241241
"offline": "Offline",
242242
"connected": "Verbunden",
243-
"reconnecting": "Verbindung wird wieder hergestellt..."
243+
"reconnecting": "Verbindung wird wieder hergestellt...",
244+
"hide": "Ausblenden"
244245
},
245246
"auth": {
246247
"loginTitle": "Anmelden",
@@ -373,7 +374,12 @@
373374
"tags": "Tags",
374375
"noTagsFound": "Keine Tags gefunden",
375376
"searchTags": "Tags suchen...",
376-
"copyRawContent": "Markdown kopieren"
377+
"copyRawContent": "Markdown kopieren",
378+
"printSaveAsPdf": "Drucken / Als PDF speichern",
379+
"tableOfContents": "Inhaltsverzeichnis",
380+
"wordCount": "{count, plural, one {# Wort} other {# Wörter}}",
381+
"charCount": "{count, plural, one {# Zeichen} other {# Zeichen}}",
382+
"readingTime": "{count, plural, one {# Minute Lesezeit} other {# Minuten Lesezeit}}"
377383
},
378384
"checklists": {
379385
"title": "Aufgabenlisten",

app/_translations/en.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@
244244
"copiedToClipboard": "Copied to clipboard",
245245
"offline": "Offline",
246246
"connected": "Connected",
247-
"reconnecting": "Reconnecting..."
247+
"reconnecting": "Reconnecting...",
248+
"hide": "Hide"
248249
},
249250
"history": {
250251
"noteHistory": "Note History",
@@ -402,6 +403,11 @@
402403
"unarchiveNote": "Unarchive Note",
403404
"enterNoteName": "Enter note name...",
404405
"updateNote": "Update Note",
406+
"printSaveAsPdf": "Print / Save as PDF",
407+
"tableOfContents": "Table of Contents",
408+
"wordCount": "{count, plural, one {# word} other {# words}}",
409+
"charCount": "{count, plural, one {# character} other {# characters}}",
410+
"readingTime": "{count, plural, one {# minute read} other {# minutes read}}",
405411
"tags": "Tags",
406412
"noTagsFound": "No tags found",
407413
"searchTags": "Search tags..."

app/_translations/es.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240
"copiedToClipboard": "Copiado al portapapeles",
241241
"offline": "Desconectado",
242242
"connected": "Conectado",
243-
"reconnecting": "Reconectando..."
243+
"reconnecting": "Reconectando...",
244+
"hide": "Ocultar"
244245
},
245246
"auth": {
246247
"loginTitle": "Iniciar sesión",
@@ -374,7 +375,12 @@
374375
"tags": "Etiquetas",
375376
"noTagsFound": "No se encontraron etiquetas",
376377
"searchTags": "Buscar etiquetas...",
377-
"copyRawContent": "Copiar markdown"
378+
"copyRawContent": "Copiar markdown",
379+
"printSaveAsPdf": "Imprimir / Guardar como PDF",
380+
"tableOfContents": "Tabla de contenidos",
381+
"wordCount": "{count, plural, one {# palabra} other {# palabras}}",
382+
"charCount": "{count, plural, one {# carácter} other {# caracteres}}",
383+
"readingTime": "{count, plural, one {# minuto de lectura} other {# minutos de lectura}}"
378384
},
379385
"checklists": {
380386
"title": "Listas",

app/_translations/fr.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240
"copiedToClipboard": "Copié dans le presse-papiers",
241241
"offline": "Hors ligne",
242242
"connected": "Connecté",
243-
"reconnecting": "Reconnexion..."
243+
"reconnecting": "Reconnexion...",
244+
"hide": "Masquer"
244245
},
245246
"auth": {
246247
"loginTitle": "Connexion",
@@ -374,7 +375,12 @@
374375
"tags": "Tags",
375376
"noTagsFound": "Aucun tag trouvé",
376377
"searchTags": "Rechercher des tags...",
377-
"copyRawContent": "Copier markdown"
378+
"copyRawContent": "Copier markdown",
379+
"printSaveAsPdf": "Imprimer / Enregistrer en PDF",
380+
"tableOfContents": "Table des matières",
381+
"wordCount": "{count, plural, one {# mot} other {# mots}}",
382+
"charCount": "{count, plural, one {# caractère} other {# caractères}}",
383+
"readingTime": "{count, plural, one {# minute de lecture} other {# minutes de lecture}}"
378384
},
379385
"checklists": {
380386
"title": "Listes",

app/_translations/it.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240
"copiedToClipboard": "Copiato negli appunti",
241241
"offline": "Non in linea",
242242
"connected": "Collegato",
243-
"reconnecting": "Riconnessione..."
243+
"reconnecting": "Riconnessione...",
244+
"hide": "Nascondi"
244245
},
245246
"auth": {
246247
"loginTitle": "Accedi",
@@ -374,7 +375,12 @@
374375
"tags": "Tag",
375376
"noTagsFound": "Nessun tag trovato",
376377
"searchTags": "Cerca tag...",
377-
"copyRawContent": "Copia il markdown"
378+
"copyRawContent": "Copia il markdown",
379+
"printSaveAsPdf": "Stampa / Salva come PDF",
380+
"tableOfContents": "Indice",
381+
"wordCount": "{count, plural, one {# parola} other {# parole}}",
382+
"charCount": "{count, plural, one {# carattere} other {# caratteri}}",
383+
"readingTime": "{count, plural, one {# minuto di lettura} other {# minuti di lettura}}"
378384
},
379385
"checklists": {
380386
"title": "Checklist",

app/_translations/klingon.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@
243243
"copiedToClipboard": "De' lI'lu'pu'",
244244
"offline": "Offline",
245245
"connected": "Connected",
246-
"reconnecting": "Reconnecting..."
246+
"reconnecting": "Reconnecting...",
247+
"hide": "So'"
247248
},
248249
"history": {
249250
"noteHistory": "ghItlh Qu' tetlh",
@@ -403,7 +404,12 @@
403404
"updateNote": "ghItlh yIchoH",
404405
"tags": "meq",
405406
"noTagsFound": "meqmey tu'be'lu'",
406-
"searchTags": "meqmey yInej..."
407+
"searchTags": "meqmey yInej...",
408+
"printSaveAsPdf": "nagh / PDF rur pol",
409+
"tableOfContents": "De'wI' tetlh",
410+
"wordCount": "{count, plural, one {# mu'} other {# mu'mey}}",
411+
"charCount": "{count, plural, one {# Degh} other {# Deghmey}}",
412+
"readingTime": "{count, plural, one {# tup laD} other {# tupmey laD}}"
407413
},
408414
"checklists": {
409415
"title": "tetlhmey",

0 commit comments

Comments
 (0)