i18n
Localize ColdBox applications with cbi18n — resource bundles, locales, and per-request language detection.
cbi18n adds internationalization to ColdBox: resource bundles, locale-aware messages, and per-request locale detection.
box install cbi18nQuick Example
Store messages in resource bundles (Java .properties style), resolve them anywhere:
# includes/i18n/main_en.properties
welcome = Welcome back, {name}!# includes/i18n/main_es.properties
welcome = ¡Bienvenido de nuevo, {name}!// In a handler or view
property name="i18n" inject="i18n@cbi18n";
message = i18n.getResource(
resource : "welcome@main",
values : [ user.getName() ]
)The module can detect the user's locale from the request (Accept-Language, URL, or cookie) and store it in the request context, so every getResource() call resolves in the right language automatically.
When to Use It
Multi-language applications
Locale-aware validation messages (pairs with cbvalidation)
Centralizing user-facing strings out of views
See Also
Validation — localized error messages
Request Context — where the detected locale lives
Last updated
Was this helpful?