From 6c2d8e014733e0c17f1d9b4fc8a8719cce60a49d Mon Sep 17 00:00:00 2001 From: Tugdual Grall Date: Fri, 4 Jul 2025 01:14:30 +0200 Subject: [PATCH] Add prompt for adding a new language to Next.js using next-intl (#34) * Add prompt for adding a new language to Next.js using next-intl * Update README and prompt for Next.js i18n integration with next-intl --- README.md | 1 + prompts/next-intl-add-language.prompt.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 prompts/next-intl-add-language.prompt.md diff --git a/README.md b/README.md index 8005db3..0ef0e35 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi - [Multi Stage Dockerfile](prompts/multi-stage-dockerfile.prompt.md) - Create optimized multi-stage Dockerfiles for any language or framework - [My Issues](prompts/my-issues.prompt.md) - List my issues in the current repository - [My Pull Requests](prompts/my-pull-requests.prompt.md) - List my pull requests in the current repository +- [Next Intl Add Language](prompts/next-intl-add-language.prompt.md) - Add new language to a Next.js + next-intl application > 💡 **Usage**: Use `/prompt-name` in VS Code chat, run `Chat: Run Prompt` command, or hit the run button while you have a prompt open. diff --git a/prompts/next-intl-add-language.prompt.md b/prompts/next-intl-add-language.prompt.md new file mode 100644 index 0000000..16566a2 --- /dev/null +++ b/prompts/next-intl-add-language.prompt.md @@ -0,0 +1,20 @@ +--- +mode: 'agent' +tools: ['changes','codebase', 'editFiles', 'findTestFiles', 'search', 'writeTest'] +description: 'Add new language to a Next.js + next-intl application' +--- + +This is a guide to add a new language to a Next.js project using next-intl for internationalization, + +- For i18n, the application uses next-intl. +- All translations are in the directory `./messages`. +- The UI component is `src/components/language-toggle.tsx`. +- Routing and middleware configuration are handled in: + - `src/i18n/routing.ts` + - `src/middleware.ts` + +When adding a new language: + +- Translate all the content of `en.json` to the new language. The goal is to have all the JSON entries in the new language for a complete translation. +- Add the path in `routing.ts` and `middleware.ts`. +- Add the language to `language-toggle.tsx`.