Internationalization
Multi-language support with locale routing and use-intl.
Raypx supports multiple languages through two separate but related internationalization systems:
- App i18n -- handles the main application UI translations using
@raypx/i18nanduse-intl. - Docs i18n -- handles documentation translations using Fumadocs' built-in i18n system.
Supported Languages
| Language | App Locale | Docs Locale |
|---|---|---|
| English | en-US | en-US |
| Chinese (Simplified) | zh-CN | zh-CN |
App Locale Routing
The main application uses a URL-based locale prefix for all pages:
/en-US/dashboard -- English
/zh-CN/dashboard -- Chinese
/api/health -- API routes (no locale prefix)
/__ -- Internal paths (no locale prefix)Every user-facing page URL includes the locale segment. The default locale (en-US) is also included in the URL -- there is no prefix-as-default mode.
Docs Locale Routing
Documentation uses Fumadocs' built-in i18n with a different URL structure:
/en-US/docs/packages -- English docs
/docs/zh-CN/packages -- Chinese docs
/docs -- Redirects to /docs/en-USDocs content is organized in content/docs/{locale}/ directories.
Locale Detection Priority
For the app, the locale is determined in this order:
- URL path -- the first path segment is checked against supported locales.
- Cookie -- if the path has no locale prefix (e.g., API routes), the
raypx-localecookie is checked. - Default -- falls back to
en-US.
Cookie
The locale preference is stored in a cookie named raypx-locale with the following attributes:
raypx-locale=en-US; Path=/; Max-Age=31536000; SameSite=LaxThe cookie is set when a user switches languages and persists for one year.