Back to ✨ Feature Scaffolding

Setup Internationalization (i18n)

i18nNext.jsLocalization
---
description: Configure next-intl for multi-language support
---

1. **Install next-intl**:
- Install the library.
// turbo
- Run npm install next-intl

2. **Create Messages**:
- Create messages/en.json and messages/es.json.
{
"Index": {
"title": "Hello world!"
}
}


3. **Configure Middleware**:
- Create src/middleware.ts to handle locale routing.
import createMiddleware from 'next-intl/middleware';

export default createMiddleware({
locales: ['en', 'es', 'fr'],
defaultLocale: 'en'
});

export const config = {
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)']
};


4. **Create i18n Config**:
- Create src/i18n.ts for message loading.
import { getRequestConfig } from 'next-intl/server';

export default getRequestConfig(async ({ locale }) => ({
messages: (await import(../messages/${locale}.json)).default
}));


5. **Pro Tips**:
- Keep your translation keys organized by page or component.
- Use the useTranslations hook in client components.
- Use the getTranslations function in server components.
By Antigravity Team

How to Use This Workflow

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/workflows/
  3. Save the file as setup-internationalization-i18n-next-intl.md
  4. In Antigravity, type /setup_internationalization_i18n_next_intl or just describe what you want to do

Learn more about workflows →

Related Workflows

Recommended Rules

View more rules →

Recommended MCP Servers

View more MCP servers →

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide