Version: current

# Package sapphire\i18n

## Classes summary

DBLocale | Locale database field, mainly used in `Translatable` extension.
i18nTextCollector | SilverStripe-variant of the "gettext" tool: Parses the string content of all PHP-files and SilverStripe templates for ocurrences of the _t() translation method. Also uses the `i18nEntityProvider` interface to get dynamically defined entities by executing the provideI18nEntities() method on all implementors of this interface.
Translatable | The Translatable decorator allows your DataObjects to have versions in different languages, defining which fields are can be translated. Translatable can be applied to any `DataObject` subclass, but is mostly used with `SiteTree`. Translatable is compatible with the `Versioned` extension. To avoid cluttering up the database-schema of the 99% of sites without multiple languages, the translation-feature is disabled by default.

## Interfaces summary

i18nEntityProvider | Dynamically provide translatable entites for the `i18n` logic. This is particularly handy for natural language strings in static variables of a class definition, as the _t() method can only be used in a runtime/instance context. The provideI18nEntities() method enables you to define your own entities with your custom naming, mostly involving either the variable name or the array key. With this in place, you can use a getter method to trigger translation of your values. For any statics containing natural language, never use the static directly - always wrap it in a getter.

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -