Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["oxc.oxc-vscode"],
"recommendations": ["oxc.oxc-vscode"]
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enableScripts: true
nodeLinker: node-modules

catalog:
next: "^16.2.7"
oxfmt: "^0.45.0"
oxlint: "^1.60.0"
typescript: "^6.0.3"
26 changes: 13 additions & 13 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"formatter": [
{
"language_server": {
"name": "oxfmt",
},
"formatter": [
{
"language_server": {
"name": "oxfmt"
}
},
{
"code_action": "source.fixAll.oxc"
}
],
"prettier": {
"allowed": false
},
{
"code_action": "source.fixAll.oxc",
},
],
"prettier": {
"allowed": false,
},
"language_servers": ["!eslint", "!biome", "..."],
"language_servers": ["!eslint", "!biome", "..."]
}
1 change: 1 addition & 0 deletions apps/example-next-intl/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REDIRECTIONIO_TOKEN=
46 changes: 46 additions & 0 deletions apps/example-next-intl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*
!.env.example

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# playwright
playwright-report/
test-results
36 changes: 36 additions & 0 deletions apps/example-next-intl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
5 changes: 5 additions & 0 deletions apps/example-next-intl/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"home": {
"welcome": "Welcome to the example app"
}
}
5 changes: 5 additions & 0 deletions apps/example-next-intl/messages/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"home": {
"welcome": "Bienvenue sur l'exemple d'application"
}
}
7 changes: 7 additions & 0 deletions apps/example-next-intl/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";

const nextConfig: NextConfig = {};

const withNextIntl = createNextIntlPlugin();
export default withNextIntl(nextConfig);
33 changes: 33 additions & 0 deletions apps/example-next-intl/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "example-next-intl",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --port 3002",
"build": "next build",
"start": "next start --port 3002",
"lint": "oxlint --config ../../.oxlintrc.json",
"lint:fix": "oxlint --fix --config ../../.oxlintrc.json",
"format": "oxfmt -c ../../.oxfmtrc.json",
"format:check": "oxfmt -c ../../.oxfmtrc.json --check",
"test:e2e": "playwright test"
},
"dependencies": {
"@redirection.io/vercel-middleware": "workspace:*",
"next": "catalog:",
"next-intl": "^4.13.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
"devDependencies": {
"@playwright/test": "^1.60",
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"oxfmt": "catalog:",
"oxlint": "catalog:",
"tailwindcss": "^4",
"typescript": "catalog:"
}
}
7 changes: 7 additions & 0 deletions apps/example-next-intl/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};

export default config;
1 change: 1 addition & 0 deletions apps/example-next-intl/public/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/example-next-intl/public/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/example-next-intl/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/example-next-intl/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/example-next-intl/public/window.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions apps/example-next-intl/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { routing } from "@/i18n/routing";
import type { Metadata } from "next";
import { hasLocale, NextIntlClientProvider } from "next-intl";
import { Geist, Geist_Mono } from "next/font/google";
import { notFound } from "next/navigation";

const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default async function LocaleLayout({ children, params }: LayoutProps<"/[locale]">) {
const { locale } = await params;
if (!hasLocale(routing.locales, locale)) {
notFound();
}

return (
<html lang={locale} className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
<body className="min-h-full flex flex-col">
<NextIntlClientProvider>{children}</NextIntlClientProvider>
</body>
</html>
);
}
11 changes: 11 additions & 0 deletions apps/example-next-intl/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getTranslations } from "next-intl/server";

export default async function Home() {
const t = await getTranslations("home");

return (
<div>
<span>{t("welcome")}</span>
</div>
);
}
13 changes: 13 additions & 0 deletions apps/example-next-intl/src/i18n/request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getRequestConfig } from "next-intl/server";
import { hasLocale } from "next-intl";
import { routing } from "./routing";

export default getRequestConfig(async ({ requestLocale }) => {
const requested = await requestLocale;
const locale = hasLocale(routing.locales, requested) ? requested : routing.defaultLocale;

return {
locale,
messages: (await import(`../../messages/${locale}.json`)).default,
};
});
6 changes: 6 additions & 0 deletions apps/example-next-intl/src/i18n/routing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineRouting } from "next-intl/routing";

export const routing = defineRouting({
locales: ["en", "fr"],
defaultLocale: "en",
});
5 changes: 5 additions & 0 deletions apps/example-next-intl/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { registerRedirectionIoInstrumentation } from "@redirection.io/vercel-middleware/instrumentation";

export const register = async () => {
registerRedirectionIoInstrumentation();
};
27 changes: 27 additions & 0 deletions apps/example-next-intl/src/proxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { routing } from "@/i18n/routing";
import { createRedirectionIoMiddleware } from "@redirection.io/vercel-middleware/next";
import createMiddleware from "next-intl/middleware";
import { NextRequest } from "next/server";

const routingMiddleware = createMiddleware(routing);

function middleware(request: Request) {
const response = routingMiddleware(request as NextRequest);
return response;
}

export default createRedirectionIoMiddleware({
nextMiddleware: middleware,
});

// export default middleware;

export const config = {
unstable_allowDynamic: ["/node_modules/@redirection.io/**"],
matcher: [
// Match all pathnames except for
// - … if they start with `/api`, `/_next` or `/_vercel`
// - … the ones containing a dot (e.g. `favicon.ico`)
"/((?!api|_next/static|_next/image|.*\\.png$).*)?",
],
};
27 changes: 27 additions & 0 deletions apps/example-next-intl/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts", "**/*.mts"],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions apps/example-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@redirection.io/vercel-middleware": "workspace:*",
"next": "16.2.4",
"next": "catalog:",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand All @@ -25,6 +25,6 @@
"oxfmt": "catalog:",
"oxlint": "catalog:",
"tailwindcss": "^4",
"typescript": "^5"
"typescript": "catalog:"
}
}
2 changes: 1 addition & 1 deletion apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@redirection.io/vercel-middleware": "workspace:*",
"next": "16.2.4",
"next": "catalog:",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
Loading
Loading