Installation

INSTRUCTIONS

Just drop into your modules folder or use the box-cli to install

box install cbi18n

This module registers the following models in WireBox:

  • i18n@cbi18n : Helper with all kinds of methods for localization

  • resourceService@cbi18n : Service to interact with language resource bundles

Settings

You can add a i18n structure of settings to your ColdBox.cfc or to any other module configuration file: ModuleConfig.cfc to configure the module:

i18n = {
    // The base path of the default resource bundle to load
    defaultResourceBundle = "includes/i18n/main",
    // The default locale of the application
    defaultLocale = "en_US",
    // The storage to use for user's locale: session, client, cookie, request
    localeStorage = "cookie",
    // The value to show when a translation is not found
    unknownTranslation = "**NOT FOUND**",
    // Extra resource bundles to load
    resourceBundles = {
        alias = "path"
    }
};

Each module in your ColdBox Application can have its own resource bundles that can be loaded by this module.

Resource bundles are .properties files that contain your translations.

Mixin Helpers

The module registers the following methods for handlers/layouts/views/interceptors:

Last updated

Was this helpful?