-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from sebiweise/feature/i18n
Feature/i18n
- Loading branch information
Showing
213 changed files
with
3,750 additions
and
3,525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
timeout-minutes: 15 | ||
strategy: | ||
matrix: | ||
version: [18, 20] | ||
pnpm: [8, latest] | ||
runs-on: ubuntu-latest | ||
# To use Remote Caching, uncomment the next lines and follow the steps below. | ||
# env: | ||
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
# TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
|
||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
version: ${{ matrix.pnpm }} | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.10.5 | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
node-version: ${{ matrix.version }} | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
run: pnpm install --prefer-offline --frozen-lockfile | ||
# - run: pnpx playwright install chromium | ||
- run: pnpm run ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,7 @@ next-env.d.ts | |
.idea | ||
|
||
# ide | ||
.vscode/ | ||
.vscode/ | ||
|
||
# Localazy | ||
localazy.keys.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# 🚧 Localization | ||
|
||
## Help translate unsaged | ||
|
||
https://localazy.com/p/unsaged | ||
|
||
## Update translation files | ||
1. Create a localazy.keys.json in the root folder apps/unsaged https://localazy.com/docs/cli/authorization#separate-key-file | ||
2. Paste in the required readKey | ||
3. Run pnpm run local:pull or turbo local:pull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use client"; | ||
|
||
import { ReactNode } from "react"; | ||
import { NextIntlClientProvider, AbstractIntlMessages } from "next-intl"; | ||
|
||
type Props = { | ||
messages: AbstractIntlMessages; | ||
locale: string; | ||
children: ReactNode; | ||
now: Date; | ||
timeZone: string; | ||
}; | ||
|
||
export default function NextIntlProvider({ | ||
messages, | ||
locale, | ||
children, | ||
now, | ||
timeZone, | ||
}: Props) { | ||
return ( | ||
<NextIntlClientProvider | ||
locale={locale} | ||
messages={messages} | ||
defaultTranslationValues={{ | ||
i: (text) => <i>{text}</i>, | ||
}} | ||
now={now} | ||
timeZone={timeZone} | ||
formats={{ | ||
dateTime: { | ||
short: { | ||
day: 'numeric', | ||
month: 'short', | ||
year: 'numeric' | ||
} | ||
}, | ||
number: { | ||
precise: { | ||
maximumFractionDigits: 5 | ||
} | ||
}, | ||
list: { | ||
enumeration: { | ||
style: 'long', | ||
type: 'conjunction' | ||
} | ||
} | ||
}} | ||
> | ||
{children} | ||
</NextIntlClientProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { DEFAULT_DESCRIPTION, DEFAULT_TITLE } from '@/utils/app/const'; | ||
|
||
import { Analytics } from '@vercel/analytics/react'; | ||
import { AxiomWebVitals } from 'next-axiom'; | ||
|
||
import { Metadata, Viewport } from 'next'; | ||
|
||
import { ThemeProvider } from '@/components/common/ui/theme-provider'; | ||
|
||
import '@/styles/globals.css'; | ||
import NextIntlProvider from './NextIntlProvider'; | ||
import { notFound } from 'next/navigation'; | ||
import { ReactNode } from 'react'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
params: { locale: string }; | ||
}; | ||
|
||
export const metadata: Metadata = { | ||
title: DEFAULT_TITLE, | ||
description: DEFAULT_DESCRIPTION, | ||
}; | ||
|
||
export const viewport: Viewport = { | ||
height: 'device-height', | ||
width: 'device-width', | ||
initialScale: 1, | ||
} | ||
|
||
export function generateStaticParams() { | ||
return [{ locale: "en" }]; | ||
} | ||
|
||
export default async function LocaleLayout({ | ||
children, | ||
params: { locale } | ||
}: Props) { | ||
let messages; | ||
try { | ||
messages = (await import(`../../messages/${locale}.json`)).default; | ||
} catch (error) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<html lang={locale}> | ||
<Analytics /> | ||
<AxiomWebVitals /> | ||
<body className="absolute inset-0 overflow-hidden overscroll-none h-full w-full"> | ||
<NextIntlProvider | ||
locale={locale} | ||
messages={messages} | ||
timeZone="Europe/Berlin" | ||
now={new Date()} | ||
> | ||
<ThemeProvider | ||
attribute="class" | ||
defaultTheme="system" | ||
enableSystem | ||
disableTransitionOnChange | ||
> | ||
{children} | ||
</ThemeProvider> | ||
</NextIntlProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,12 @@ | ||
import { DEFAULT_DESCRIPTION, DEFAULT_TITLE } from '@/utils/app/const'; | ||
import { ReactNode } from 'react'; | ||
|
||
import { Analytics } from '@vercel/analytics/react'; | ||
import { AxiomWebVitals } from 'next-axiom'; | ||
|
||
import { Metadata } from 'next'; | ||
|
||
import { ThemeProvider } from '@/components/common/ui/theme-provider'; | ||
|
||
import '@/styles/globals.css'; | ||
|
||
export const metadata: Metadata = { | ||
title: DEFAULT_TITLE, | ||
description: DEFAULT_DESCRIPTION, | ||
viewport: | ||
'height=device-height, width=device-width, initial-scale=1, user-scalable=no', | ||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
export default function RootLayout({ | ||
// Layouts must accept a children prop. | ||
// This will be populated with nested layouts or pages | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<html lang="en"> | ||
<Analytics /> | ||
<AxiomWebVitals /> | ||
<body className="absolute inset-0 overflow-hidden overscroll-none h-full w-full"> | ||
<ThemeProvider | ||
attribute="class" | ||
defaultTheme="system" | ||
enableSystem | ||
disableTransitionOnChange | ||
> | ||
{children} | ||
</ThemeProvider> | ||
</body> | ||
</html> | ||
); | ||
} | ||
// Even though this component is just passing its children through, the presence | ||
// of this file fixes an issue in Next.js 13.3.0 where link clicks that switch | ||
// the locale would otherwise be ignored. | ||
export default function RootLayout({ children }: Props) { | ||
return children; | ||
} |
Oops, something went wrong.