Skip to content

Commit

Permalink
fix: add i18n transalations and change translation word with project
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Carpini authored and Giacomo Materozzi committed Mar 10, 2024
1 parent 160e7d1 commit c2340b9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ pnpm install
cp .env.example .env.local
```

3. Run local db with docker
3. Launch local db with docker daemon

```sh
docker-compose up
docker-compose up -d
```

4. Run migrations
Expand Down
5 changes: 3 additions & 2 deletions app/(dashboard)/dashboard/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import i18n from "@/lib/i18n"
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"
import { TranslationCreateButton } from "@/components/translation-create-button"
Expand All @@ -7,8 +8,8 @@ export default function DashboardLoading() {
return (
<DashboardShell>
<DashboardHeader
heading="Translations"
text="Create and manage translations."
heading={i18n.t("app.dashboard.Projects")}
text={i18n.t("app.dashboard.Create manage projects")}
>
<TranslationCreateButton />
</DashboardHeader>
Expand Down
9 changes: 5 additions & 4 deletions app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { redirect } from "next/navigation"

import { authOptions } from "@/lib/auth"
import { db } from "@/lib/db"
import i18n from "@/lib/i18n"
import { getCurrentUser } from "@/lib/session"
import { EmptyPlaceholder } from "@/components/empty-placeholder"
import { DashboardHeader } from "@/components/header"
Expand Down Expand Up @@ -38,8 +39,8 @@ export default async function DashboardPage() {
return (
<DashboardShell>
<DashboardHeader
heading="Translations"
text="Create and manage translations."
heading={i18n.t("app.dashboard.Projects")}
text={i18n.t("app.dashboard.Create manage projects")}
>
<TranslationCreateButton />
</DashboardHeader>
Expand All @@ -54,10 +55,10 @@ export default async function DashboardPage() {
<EmptyPlaceholder>
<EmptyPlaceholder.Icon name="translation" />
<EmptyPlaceholder.Title>
No translations created
{i18n.t("app.dashboard.No project added")}
</EmptyPlaceholder.Title>
<EmptyPlaceholder.Description>
You don&apos;t have any translations yet. Start creating content.
{i18n.t("app.dashboard.No project added.description")}
</EmptyPlaceholder.Description>
<TranslationCreateButton variant="outline" />
</EmptyPlaceholder>
Expand Down
3 changes: 2 additions & 1 deletion components/translation-create-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import * as React from "react"
import { useRouter } from "next/navigation"

import i18n from "@/lib/i18n"
import { cn } from "@/lib/utils"
import { ButtonProps, buttonVariants } from "@/components/ui/button"
import { toast } from "@/components/ui/use-toast"
Expand Down Expand Up @@ -75,7 +76,7 @@ export function TranslationCreateButton({
) : (
<Icons.add className="mr-2 h-4 w-4" />
)}
New translation
{i18n.t("app.New project")}
</button>
)
}
3 changes: 2 additions & 1 deletion config/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { DashboardConfig } from "types"
import i18n from "@/lib/i18n"

export const dashboardConfig: DashboardConfig = {
mainNav: [],
sidebarNav: [
{
id: "translations",
title: "Translations",
title: i18n.t("app.dashboard.Projects"),
href: "/dashboard",
icon: "translation",
},
Expand Down
9 changes: 7 additions & 2 deletions lib/i18n/languages/en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"app.Get started": "Get started"
}
"app.Get started": "Get started",
"app.New project": "New project",
"app.dashboard.Projects": "Projects",
"app.dashboard.Create manage projects": "Create and manage translation projects.",
"app.dashboard.No project added": "No project added",
"app.dashboard.No project added.description": "You don't have any project yet. Start creating content."
}

0 comments on commit c2340b9

Please sign in to comment.