Skip to content

Commit

Permalink
deeper locale support
Browse files Browse the repository at this point in the history
  • Loading branch information
potts99 committed Nov 28, 2023
1 parent 54965ea commit 3a04b77
Show file tree
Hide file tree
Showing 19 changed files with 816 additions and 235 deletions.
12 changes: 3 additions & 9 deletions apps/client/components/ListTodo/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TrashIcon } from "@heroicons/react/20/solid";
import { getCookie } from "cookies-next";
import useTranslation from "next-translate/useTranslation";
import { useState } from "react";
import { useQuery } from "react-query";

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

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

const [minValue, setMinValue] = useState(0);
Expand Down Expand Up @@ -50,8 +52,6 @@ export default function ListTodo() {
});
}

console.log(data);

async function deleteTodo(id) {
await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/todo/${id}/delete`, {
method: "DELETE",
Expand All @@ -62,12 +62,6 @@ export default function ListTodo() {
}).then(() => refetch());
}

// async function markDone(id) {
// await fetch(`api/v1/todo/mark-done/${id}`, {
// method: "POST",
// }).then(() => refetch());
// }

const handleKeyDown = (event) => {
if (event.key === "Enter") {
onSubmit();
Expand All @@ -83,7 +77,7 @@ export default function ListTodo() {
name="text"
id="text"
className="w-full shadow-sm text-gray-900 bg-gray-100 rounded-lg font-semibold border-none focus:outline-none "
placeholder="Enter todo here..."
placeholder={t("enter_todo")}
onChange={(e) => {
setText(e.target.value);
}}
Expand Down
6 changes: 3 additions & 3 deletions apps/client/i18n.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
locales: ['en', 'de', 'se'],
defaultLocale: 'en',
locales: ["en", "da", "de", "es", "fr", "no", "pt", "se", "tl"],
defaultLocale: "en",
pages: {
'*': ['peppermint'],
"*": ["peppermint"],
},
localeDetection: false,
};
18 changes: 9 additions & 9 deletions apps/client/layouts/newLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function NewLayout({ children }: any) {

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

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

// delete session cookie
if (res.success) {
deleteCookie("session");
location.reload();
Expand All @@ -111,9 +109,9 @@ export default function NewLayout({ children }: any) {
getQueues();
}, [user]);

useEffect(() => {
// location.push(`${locale}/${location.pathname}`);
}, []);
// useEffect(() => {
// location.push(`${locale}/${location.pathname}`);
// }, [user, location]);

const handleKeyPress = useCallback((event: any) => {
if (
Expand Down Expand Up @@ -458,7 +456,9 @@ export default function NewLayout({ children }: any) {
className="h-6 w-6 shrink-0 text-white group-hover:text-white"
aria-hidden="true"
/>
<span className="whitespace-nowrap">Admin Settings</span>
<span className="whitespace-nowrap">
{t("admin_settings")}
</span>
<div className="flex w-full justify-end float-right">
<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">
a
Expand Down Expand Up @@ -557,7 +557,7 @@ export default function NewLayout({ children }: any) {
"block px-3 text-sm font-bold h-full p-2 w-full rounded-md text-gray-900"
)}
>
Profile
{t("profile")}
</Link>
)}
</Menu.Item>
Expand All @@ -572,7 +572,7 @@ export default function NewLayout({ children }: any) {
"block px-3 text-left text-sm font-bold h-full p-2 w-full rounded-md text-gray-900"
)}
>
Sign Out
{t("logout")}
</button>
)}
</Menu.Item>
Expand Down
80 changes: 80 additions & 0 deletions apps/client/locales/da/peppermint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"hello_good": "Godt",
"hello_morning": "Morgen",
"hello_afternoon": "Eftermiddag",
"sl_dashboard": "Instrumentbræt",
"sl_tickets": "Billetter",
"sl_history": "Historie",
"sl_notebook": "Personlig notesbog",
"sl_users": "Brugere",
"sl_clients": "Kunder",
"sl_settings": "Indstillinger",
"open_tickets": "Åbne billetter",
"completed_tickets": "Afsluttede billetter",
"account_status": "Kontostatus",
"todo_list": "Opgaveliste",
"personal_files": "Personlige filer",
"create_ticket": "Opret billet",
"ticket_new": "Ny billet",
"ticket_name_here": "Navn",
"ticket_email_here": "Email",
"ticket_details": "Titel",
"ticket_select_client": "Vælg en klient",
"ticket_select_eng": "Vælg en ingeniør",
"ticket_extra_details": "Indtast ekstra detaljer her.... understøtter markdown",
"cancel": "Annuller",
"create": "Opret",
"low": "Lav",
"normal": "Normal",
"high": "Høj",
"edit-btn": "Rediger",
"reset_password": "Nulstil adgangskode",
"internal_users": "Interne brugere",
"clients": "Kunder",
"new_user": "Ny bruger",
"new_client": "Ny klient",
"previous": "Forrige",
"next": "Næste",
"show": "Vis",
"name": "Navn",
"email": "Email",
"settings": "Indstillinger",
"webhooks": "Webhooks",
"version": "Version",
"v_profile": "Se profil",
"reminders": "Påmindelser",
"title": "Titel",
"priority": "Prioritet",
"status": "Status",
"created": "Oprettet",
"assigned_to": "Tildelt til",
"enter_todo": "Indtast opgave",
"notebooks": "Notesbøger",
"notebooks_description": "Dette er en personlig notesbog, du kan bruge den til at gemme noter, links, kodeeksempler osv.",
"create_notebook": "Opret notesbog",
"open": "Åben",
"assigned_to_me": "Tildelt til mig",
"unassigned": "Ikke tildelt",
"closed": "Lukket",
"description": "Beskrivelse",
"comments": "Kommentarer",
"leave_comment": "Efterlad en kommentar",
"close_issue": "Luk problem",
"comment": "Kommentar",
"save": "Gem",
"labels": "Mærker",
"created_at": "Oprettet den",
"updated_at": "Opdateret den",
"hide_ticket": "Skjul billet",
"show_ticket": "Vis globalt",
"open_issue": "Åbn problem",
"closed_issue": "Lukket problem",
"recent_tickets": "Seneste billetter",
"notebook_title": "Notesbogstitel",
"admin_settings": "Administratorindstillinger",
"profile": "Profil",
"logout": "Log ud",
"unassigned_tickets": "Ikke tildelte billetter"

}

98 changes: 65 additions & 33 deletions apps/client/locales/de/peppermint.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,78 @@
{
"hello_good": "Wunderschönen",
"hello_good": "Gut",
"hello_morning": "Morgen",
"hello_afternoon": "Tag",
"Account status": "Kontostatus",
"hello_afternoon": "Nachmittag",
"sl_dashboard": "Armaturenbrett",
"sl_tickets": "Eintrittskarten",
"sl_tickets": "Tickets",
"sl_history": "Verlauf",
"sl_notebook": "Persönliche Notizen",
"sl_notebook": "Persönliches Notizbuch",
"sl_users": "Benutzer",
"sl_clients": "Kunden",
"sl_settings": "Einstellungen",
"open_tickets": "Offene Tickets",
"completed_tickets": "Geschlossene Tickets",
"account_status": "Account status",
"todo_list": "Todo Liste",
"completed_tickets": "Abgeschlossene Tickets",
"account_status": "Kontostatus",
"todo_list": "Aufgabenliste",
"personal_files": "Persönliche Dateien",
"create_ticket": "Ticket erstellen",
"ticket_new": "Neues Ticket",
"ticket_name_here": "Namen hier eingeben",
"ticket_email_here": "E-Mail hier eingeben",
"ticket_details": "Tickettitel",
"ticket_select_client": "Bitte Auftraggeber auswählen",
"ticket_select_eng": "Bitte Ingenieur auswählen",
"ticket_extra_details": "Geben Sie hier zusätzliche Details ein.... Markdown wird unterstützt",
"ticket_name_here": "Name",
"ticket_email_here": "E-Mail",
"ticket_details": "Titel",
"ticket_select_client": "Kunde auswählen",
"ticket_select_eng": "Techniker auswählen",
"ticket_extra_details": "Weitere Details hier eingeben... Markdown wird unterstützt",
"cancel": "Abbrechen",
"create": "schaffen",
"low": "niedrig",
"normal": "normal",
"high": "hoch",
"edit": "",
"reset_password": "",
"internal_users": "",
"clients": "",
"new_user": "",
"new_client": "",
"previous": "",
"next": "",
"show": "",
"name": "",
"email": "",
"settings": "",
"webhooks": "",
"version": "",
"v_profile": ""
"create": "Erstellen",
"low": "Niedrig",
"normal": "Normal",
"high": "Hoch",
"edit-btn": "Bearbeiten",
"reset_password": "Passwort zurücksetzen",
"internal_users": "Interne Benutzer",
"clients": "Kunden",
"new_user": "Neuer Benutzer",
"new_client": "Neuer Kunde",
"previous": "Vorherige",
"next": "Nächste",
"show": "Anzeigen",
"name": "Name",
"email": "E-Mail",
"settings": "Einstellungen",
"webhooks": "Webhooks",
"version": "Version",
"v_profile": "Profil anzeigen",
"reminders": "Erinnerungen",
"title": "Titel",
"priority": "Priorität",
"status": "Status",
"created": "Erstellt",
"assigned_to": "Zugewiesen an",
"enter_todo": "Aufgabe eingeben",
"notebooks": "Notizbücher",
"notebooks_description": "Dies ist ein persönliches Notizbuch. Hier können Sie Notizen, Links, Code-Snippets usw. speichern.",
"create_notebook": "Notizbuch erstellen",
"open": "Öffnen",
"assigned_to_me": "Mir zugewiesen",
"unassigned": "Nicht zugewiesen",
"closed": "Geschlossen",
"description": "Beschreibung",
"comments": "Kommentare",
"leave_comment": "Kommentar hinterlassen",
"close_issue": "Problem schließen",
"comment": "Kommentar",
"save": "Speichern",
"labels": "Labels",
"created_at": "Erstellt am",
"updated_at": "Aktualisiert am",
"hide_ticket": "Ticket ausblenden",
"show_ticket": "Global anzeigen",
"open_issue": "Problem öffnen",
"closed_issue": "Geschlossenes Problem",
"recent_tickets": "Aktuelle Tickets",
"notebook_title": "Notizbuchtitel",
"admin_settings": "Admin-Einstellungen",
"profile": "Profil",
"logout": "Abmelden",
"unassigned_tickets": "Nicht zugewiesene Tickets"
}
37 changes: 35 additions & 2 deletions apps/client/locales/en/peppermint.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"low": "low",
"normal": "normal",
"high": "high",
"edit": "edit",
"edit-btn": "edit",
"reset_password": "reset password",
"internal_users": "Internal Users",
"clients": "Clients",
Expand All @@ -41,5 +41,38 @@
"settings": "Settings",
"webhooks": "Webhooks",
"version": "Version",
"v_profile": "View Profile"
"v_profile": "View Profile",
"reminders": "Reminders",
"title": "Title",
"priority": "Priority",
"status": "Status",
"created": "Created",
"assigned_to": "Assigned To",
"enter_todo": "Enter Todo",
"notebooks": "Notebooks",
"notebooks_description": "This is a personal notebook, you can use it to store notes, links, code snippets, etc.",
"create_notebook": "Create Notebook",
"open": "open",
"assigned_to_me": "Assigned to me",
"unassigned": "Unassigned",
"closed": "Closed",
"description": "description",
"comments": "comments",
"leave_comment": "Leave a comment",
"close_issue": "Close Issue",
"comment": "comment",
"save": "save",
"labels": "labels",
"created_at": "created at",
"updated_at": "updated at",
"hide_ticket": "Hide Ticket",
"show_ticket": "Show Global",
"open_issue": "Open Issue",
"closed_issue": "Closed Issue",
"recent_tickets": "Recent Tickets",
"notebook_title": "Notebook Title",
"admin_settings": "Admin Settings",
"profile": "Profile",
"logout": "Logout",
"unassigned_tickets": "Unassigned Tickets"
}
Loading

0 comments on commit 3a04b77

Please sign in to comment.