Skip to content

Internationalization (i18n)

Warp Protocol v3 is designed for global use. It supports localized text for all user-facing fields through the WarpText type.

The WarpText Type

Any text field in a Warp can be either a simple string or a localized object.

Simple String

Uses the string for all languages.

json
"title": "Send Tokens"

Localized Object

Provides translations for specific language codes.

json
"title": {
  "en": "Send Tokens",
  "de": "Token senden",
  "es": "Enviar Tokens",
  "ja": "トークンを送信"
}

Supported Fields

The following fields support WarpText:

  • Root: title, description
  • Actions: label, description
  • Inputs: label, description, patternDescription
  • Messages: success, error, and custom keys
  • Alerts: subject, body

Language Codes

Use standard ISO 639-1 two-letter language codes (e.g., en, fr, de, es, zh, ja).

Client Behavior

Clients rendering Warps follow this logic:

  1. Detect the user's preferred language (e.g., browser setting).
  2. Check if the field is an object.
  3. Look for the matching language key.
  4. Fallback: If the key is missing, look for en (English).
  5. Fallback: If en is missing, use the first available key.

Best Practices

  1. Always include en: It serves as the universal fallback.
  2. Avoid variable fragmentation: Use the same variable names in all translations.
    json
    // ✅ Good
    "en": "Sent {{amount}}",
    "de": "{{amount}} gesendet"
  3. Keep it short: UI buttons have limited space. German text is often 30% longer than English.