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:
- Detect the user's preferred language (e.g., browser setting).
- Check if the field is an object.
- Look for the matching language key.
- Fallback: If the key is missing, look for
en(English). - Fallback: If
enis missing, use the first available key.
Best Practices
- Always include
en: It serves as the universal fallback. - Avoid variable fragmentation: Use the same variable names in all translations.json
// ✅ Good "en": "Sent {{amount}}", "de": "{{amount}} gesendet" - Keep it short: UI buttons have limited space. German text is often 30% longer than English.