Raypx

Internationalization

Multi-language support with locale routing and use-intl.

Raypx supports multiple languages through two separate but related internationalization systems:

  1. App i18n -- handles the main application UI translations using @raypx/i18n and use-intl.
  2. Docs i18n -- handles documentation translations using Fumadocs' built-in i18n system.

Supported Languages

LanguageApp LocaleDocs Locale
Englishen-USen-US
Chinese (Simplified)zh-CNzh-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-US

Docs content is organized in content/docs/{locale}/ directories.

Locale Detection Priority

For the app, the locale is determined in this order:

  1. URL path -- the first path segment is checked against supported locales.
  2. Cookie -- if the path has no locale prefix (e.g., API routes), the raypx-locale cookie is checked.
  3. Default -- falls back to en-US.

The locale preference is stored in a cookie named raypx-locale with the following attributes:

raypx-locale=en-US; Path=/; Max-Age=31536000; SameSite=Lax

The cookie is set when a user switches languages and persists for one year.

On this page