Skip to content

Commit 8ccd367

Browse files
authored
Merge pull request #192 from Peppermint-Lab/next
Improve internationalisation
2 parents aafc65e + c4ebdf1 commit 8ccd367

File tree

20 files changed

+871
-247
lines changed

20 files changed

+871
-247
lines changed

apps/client/components/ListTodo/index.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TrashIcon } from "@heroicons/react/20/solid";
22
import { getCookie } from "cookies-next";
3+
import useTranslation from "next-translate/useTranslation";
34
import { useState } from "react";
45
import { useQuery } from "react-query";
56

@@ -18,6 +19,7 @@ async function getTodos(token) {
1819

1920
export default function ListTodo() {
2021
const token = getCookie("session");
22+
const { t } = useTranslation("peppermint");
2123
const { status, data, refetch } = useQuery("repoData", () => getTodos(token));
2224

2325
const [minValue, setMinValue] = useState(0);
@@ -50,8 +52,6 @@ export default function ListTodo() {
5052
});
5153
}
5254

53-
console.log(data);
54-
5555
async function deleteTodo(id) {
5656
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/todo/${id}/delete`, {
5757
method: "DELETE",
@@ -62,12 +62,6 @@ export default function ListTodo() {
6262
}).then(() => refetch());
6363
}
6464

65-
// async function markDone(id) {
66-
// await fetch(`api/v1/todo/mark-done/${id}`, {
67-
// method: "POST",
68-
// }).then(() => refetch());
69-
// }
70-
7165
const handleKeyDown = (event) => {
7266
if (event.key === "Enter") {
7367
onSubmit();
@@ -83,7 +77,7 @@ export default function ListTodo() {
8377
name="text"
8478
id="text"
8579
className="w-full shadow-sm text-gray-900 bg-gray-100 rounded-lg font-semibold border-none focus:outline-none "
86-
placeholder="Enter todo here..."
80+
placeholder={t("enter_todo")}
8781
onChange={(e) => {
8882
setText(e.target.value);
8983
}}

apps/client/i18n.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = {
2-
locales: ['en', 'de', 'se'],
3-
defaultLocale: 'en',
2+
locales: ["en", "da", "de", "es", "fr", "no", "pt", "se", "tl"],
3+
defaultLocale: "en",
44
pages: {
5-
'*': ['peppermint'],
5+
"*": ["peppermint"],
66
},
77
localeDetection: false,
88
};

apps/client/layouts/newLayout.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function NewLayout({ children }: any) {
4343

4444
const navigation = [
4545
{
46-
name: "Create a ticket",
46+
name: t("create_ticket"),
4747
href: `/${locale}/new`,
4848
icon: PlusIcon,
4949
current: location.pathname === "/new" ? true : false,
@@ -88,7 +88,6 @@ export default function NewLayout({ children }: any) {
8888
}
8989

9090
async function logout() {
91-
// clears session on server
9291
const res = await fetch(
9392
`${process.env.NEXT_PUBLIC_API_URL}/api/v1/auth/user/${user.id}/logout`,
9493
{
@@ -100,7 +99,6 @@ export default function NewLayout({ children }: any) {
10099
}
101100
).then((res) => res.json());
102101

103-
// delete session cookie
104102
if (res.success) {
105103
deleteCookie("session");
106104
location.reload();
@@ -111,9 +109,9 @@ export default function NewLayout({ children }: any) {
111109
getQueues();
112110
}, [user]);
113111

114-
useEffect(() => {
115-
// location.push(`${locale}/${location.pathname}`);
116-
}, []);
112+
// useEffect(() => {
113+
// location.push(`${locale}/${location.pathname}`);
114+
// }, [user, location]);
117115

118116
const handleKeyPress = useCallback((event: any) => {
119117
if (
@@ -458,7 +456,9 @@ export default function NewLayout({ children }: any) {
458456
className="h-6 w-6 shrink-0 text-white group-hover:text-white"
459457
aria-hidden="true"
460458
/>
461-
<span className="whitespace-nowrap">Admin Settings</span>
459+
<span className="whitespace-nowrap">
460+
{t("admin_settings")}
461+
</span>
462462
<div className="flex w-full justify-end float-right">
463463
<span className="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border border-gray-700 bg-gray-800 text-[0.625rem] font-medium text-gray-400 group-hover:text-white">
464464
a
@@ -557,7 +557,7 @@ export default function NewLayout({ children }: any) {
557557
"block px-3 text-sm font-bold h-full p-2 w-full rounded-md text-gray-900"
558558
)}
559559
>
560-
Profile
560+
{t("profile")}
561561
</Link>
562562
)}
563563
</Menu.Item>
@@ -572,7 +572,7 @@ export default function NewLayout({ children }: any) {
572572
"block px-3 text-left text-sm font-bold h-full p-2 w-full rounded-md text-gray-900"
573573
)}
574574
>
575-
Sign Out
575+
{t("logout")}
576576
</button>
577577
)}
578578
</Menu.Item>

apps/client/layouts/settings.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { useState } from "react";
22

3+
import useTranslation from "next-translate/useTranslation";
34
import Link from "next/link";
45
import { useRouter } from "next/router";
56

67
export default function Settings({ children }) {
78
const router = useRouter();
89

10+
const { t } = useTranslation("peppermint");
11+
912
const linkStyles = {
1013
active:
1114
"w-full bg-teal-50 border-teal-500 text-teal-700 hover:bg-teal-50 hover:text-teal-700 group border-l-4 px-3 py-2 flex items-center text-sm font-medium",
@@ -46,7 +49,7 @@ export default function Settings({ children }) {
4649
d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"
4750
/>
4851
</svg>
49-
<span className="truncate">Profile</span>
52+
<span className="truncate">{t("profile")}</span>
5053
</Link>
5154

5255
<Link
@@ -72,7 +75,7 @@ export default function Settings({ children }) {
7275
d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
7376
/>
7477
</svg>
75-
<span className="truncate">Notifications</span>
78+
<span className="truncate">{t("notifications")}</span>
7679
</Link>
7780

7881
<Link
@@ -98,7 +101,7 @@ export default function Settings({ children }) {
98101
d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"
99102
/>
100103
</svg>
101-
<span className="truncate">Password</span>
104+
<span className="truncate">{t("reset_password")}</span>
102105
</Link>
103106
</nav>
104107
</aside>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"hello_good": "Godt",
3+
"hello_morning": "Morgen",
4+
"hello_afternoon": "Eftermiddag",
5+
"sl_dashboard": "Instrumentbræt",
6+
"sl_tickets": "Billetter",
7+
"sl_history": "Historie",
8+
"sl_notebook": "Personlig notesbog",
9+
"sl_users": "Brugere",
10+
"sl_clients": "Kunder",
11+
"sl_settings": "Indstillinger",
12+
"open_tickets": "Åbne billetter",
13+
"completed_tickets": "Afsluttede billetter",
14+
"account_status": "Kontostatus",
15+
"todo_list": "Opgaveliste",
16+
"personal_files": "Personlige filer",
17+
"create_ticket": "Opret billet",
18+
"ticket_new": "Ny billet",
19+
"ticket_name_here": "Navn",
20+
"ticket_email_here": "Email",
21+
"ticket_details": "Titel",
22+
"ticket_select_client": "Vælg en klient",
23+
"ticket_select_eng": "Vælg en ingeniør",
24+
"ticket_extra_details": "Indtast ekstra detaljer her.... understøtter markdown",
25+
"cancel": "Annuller",
26+
"create": "Opret",
27+
"low": "Lav",
28+
"normal": "Normal",
29+
"high": "Høj",
30+
"edit-btn": "Rediger",
31+
"reset_password": "Nulstil adgangskode",
32+
"internal_users": "Interne brugere",
33+
"clients": "Kunder",
34+
"new_user": "Ny bruger",
35+
"new_client": "Ny klient",
36+
"previous": "Forrige",
37+
"next": "Næste",
38+
"show": "Vis",
39+
"name": "Navn",
40+
"email": "Email",
41+
"settings": "Indstillinger",
42+
"webhooks": "Webhooks",
43+
"version": "Version",
44+
"v_profile": "Se profil",
45+
"reminders": "Påmindelser",
46+
"title": "Titel",
47+
"priority": "Prioritet",
48+
"status": "Status",
49+
"created": "Oprettet",
50+
"assigned_to": "Tildelt til",
51+
"enter_todo": "Indtast opgave",
52+
"notebooks": "Notesbøger",
53+
"notebooks_description": "Dette er en personlig notesbog, du kan bruge den til at gemme noter, links, kodeeksempler osv.",
54+
"create_notebook": "Opret notesbog",
55+
"open": "Åben",
56+
"assigned_to_me": "Tildelt til mig",
57+
"unassigned": "Ikke tildelt",
58+
"closed": "Lukket",
59+
"description": "Beskrivelse",
60+
"comments": "Kommentarer",
61+
"leave_comment": "Efterlad en kommentar",
62+
"close_issue": "Luk problem",
63+
"comment": "Kommentar",
64+
"save": "Gem",
65+
"labels": "Mærker",
66+
"created_at": "Oprettet den",
67+
"updated_at": "Opdateret den",
68+
"hide_ticket": "Skjul billet",
69+
"show_ticket": "Vis globalt",
70+
"open_issue": "Åbn problem",
71+
"closed_issue": "Lukket problem",
72+
"recent_tickets": "Seneste billetter",
73+
"notebook_title": "Notesbogstitel",
74+
"admin_settings": "Administratorindstillinger",
75+
"profile": "Profil",
76+
"logout": "Log ud",
77+
"unassigned_tickets": "Ikke tildelte billetter",
78+
"profile_desc": "Disse oplysninger vil blive vist offentligt, så vær forsigtig med, hvad du deler.",
79+
"language": "Sprog",
80+
"notifications": "Notifikationer",
81+
"save_and_reload": "Gem og genindlæs"
82+
83+
}
84+
Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,82 @@
11
{
2-
"hello_good": "Wunderschönen",
2+
"hello_good": "Gut",
33
"hello_morning": "Morgen",
4-
"hello_afternoon": "Tag",
5-
"Account status": "Kontostatus",
4+
"hello_afternoon": "Nachmittag",
65
"sl_dashboard": "Armaturenbrett",
7-
"sl_tickets": "Eintrittskarten",
6+
"sl_tickets": "Tickets",
87
"sl_history": "Verlauf",
9-
"sl_notebook": "Persönliche Notizen",
8+
"sl_notebook": "Persönliches Notizbuch",
109
"sl_users": "Benutzer",
1110
"sl_clients": "Kunden",
1211
"sl_settings": "Einstellungen",
1312
"open_tickets": "Offene Tickets",
14-
"completed_tickets": "Geschlossene Tickets",
15-
"account_status": "Account status",
16-
"todo_list": "Todo Liste",
13+
"completed_tickets": "Abgeschlossene Tickets",
14+
"account_status": "Kontostatus",
15+
"todo_list": "Aufgabenliste",
1716
"personal_files": "Persönliche Dateien",
1817
"create_ticket": "Ticket erstellen",
1918
"ticket_new": "Neues Ticket",
20-
"ticket_name_here": "Namen hier eingeben",
21-
"ticket_email_here": "E-Mail hier eingeben",
22-
"ticket_details": "Tickettitel",
23-
"ticket_select_client": "Bitte Auftraggeber auswählen",
24-
"ticket_select_eng": "Bitte Ingenieur auswählen",
25-
"ticket_extra_details": "Geben Sie hier zusätzliche Details ein.... Markdown wird unterstützt",
19+
"ticket_name_here": "Name",
20+
"ticket_email_here": "E-Mail",
21+
"ticket_details": "Titel",
22+
"ticket_select_client": "Kunde auswählen",
23+
"ticket_select_eng": "Techniker auswählen",
24+
"ticket_extra_details": "Weitere Details hier eingeben... Markdown wird unterstützt",
2625
"cancel": "Abbrechen",
27-
"create": "schaffen",
28-
"low": "niedrig",
29-
"normal": "normal",
30-
"high": "hoch",
31-
"edit": "",
32-
"reset_password": "",
33-
"internal_users": "",
34-
"clients": "",
35-
"new_user": "",
36-
"new_client": "",
37-
"previous": "",
38-
"next": "",
39-
"show": "",
40-
"name": "",
41-
"email": "",
42-
"settings": "",
43-
"webhooks": "",
44-
"version": "",
45-
"v_profile": ""
26+
"create": "Erstellen",
27+
"low": "Niedrig",
28+
"normal": "Normal",
29+
"high": "Hoch",
30+
"edit-btn": "Bearbeiten",
31+
"reset_password": "Passwort zurücksetzen",
32+
"internal_users": "Interne Benutzer",
33+
"clients": "Kunden",
34+
"new_user": "Neuer Benutzer",
35+
"new_client": "Neuer Kunde",
36+
"previous": "Vorherige",
37+
"next": "Nächste",
38+
"show": "Anzeigen",
39+
"name": "Name",
40+
"email": "E-Mail",
41+
"settings": "Einstellungen",
42+
"webhooks": "Webhooks",
43+
"version": "Version",
44+
"v_profile": "Profil anzeigen",
45+
"reminders": "Erinnerungen",
46+
"title": "Titel",
47+
"priority": "Priorität",
48+
"status": "Status",
49+
"created": "Erstellt",
50+
"assigned_to": "Zugewiesen an",
51+
"enter_todo": "Aufgabe eingeben",
52+
"notebooks": "Notizbücher",
53+
"notebooks_description": "Dies ist ein persönliches Notizbuch. Hier können Sie Notizen, Links, Code-Snippets usw. speichern.",
54+
"create_notebook": "Notizbuch erstellen",
55+
"open": "Öffnen",
56+
"assigned_to_me": "Mir zugewiesen",
57+
"unassigned": "Nicht zugewiesen",
58+
"closed": "Geschlossen",
59+
"description": "Beschreibung",
60+
"comments": "Kommentare",
61+
"leave_comment": "Kommentar hinterlassen",
62+
"close_issue": "Problem schließen",
63+
"comment": "Kommentar",
64+
"save": "Speichern",
65+
"labels": "Labels",
66+
"created_at": "Erstellt am",
67+
"updated_at": "Aktualisiert am",
68+
"hide_ticket": "Ticket ausblenden",
69+
"show_ticket": "Global anzeigen",
70+
"open_issue": "Problem öffnen",
71+
"closed_issue": "Geschlossenes Problem",
72+
"recent_tickets": "Aktuelle Tickets",
73+
"notebook_title": "Notizbuchtitel",
74+
"admin_settings": "Admin-Einstellungen",
75+
"profile": "Profil",
76+
"logout": "Abmelden",
77+
"unassigned_tickets": "Nicht zugewiesene Tickets",
78+
"profile_desc": "Diese Informationen werden öffentlich angezeigt, also achten Sie darauf, was Sie teilen.",
79+
"language": "Sprache",
80+
"notifications": "Benachrichtigungen",
81+
"save_and_reload": "Speichern und neu laden"
4682
}

0 commit comments

Comments
 (0)