Skip to main content

Multi-language Feature Overview

PreLaunch comes with built-in multi-language support, offering English and Chinese languages by default, which you can easily extend to other languages. This functionality is implemented using next-intl and features:
  • Support for multi-language routes (e.g., /zh/pricing and /en/pricing)
  • Language switching without page refreshes
  • Automatic default language selection based on user browser settings
  • Support for rich text and formatted content

Supported Languages

Currently, PreLaunch supports the following languages by default:
Language CodeLanguage Name
enEnglish
zhChinese

Using Multi-language Features

Content Translation

All translated text is stored in the locales/ directory:
Each JSON file contains translations for specific pages or components:

Using Translations in Components

In React components:

Using Translations in Pages

In Next.js pages:

Adding New Languages

To add a new language, follow these steps:

1. Update Configuration

Edit the middleware.ts file to add the new language code:

2. Create Translation Files

Copy an existing language directory (such as locales/en/) and create a new language directory:
Then translate the content in each JSON file.

3. Add Language Selector

PreLaunch already includes a language selector component that will automatically display new languages in the dropdown menu once added.

Best Practices

  • Use Namespaces: Group translations into different JSON files to keep your project organized
  • Maintain Key Consistency: Use the same key structure across all language files
  • Use Parameters: For text with variables, use parameters: t('welcome', { name: 'John' })
  • Use Plurals: next-intl supports plural forms, which can be used with t('items', { count: 5 })

next-intl Official Documentation

Learn more advanced features of next-intl

Configuration Documentation

Learn about the overall configuration of PreLaunch