Add multilingual capabilities to your Doctrine models.

You will need to define a class in your schema like this:

Text:
  actAs:
    I18n:
      fields: [text]
  columns:
    text: string(255)

Then, you can internationalise your own classes, and all texts will be stored in via this class.

Optionally, you can subclass this table, to create separate sets of texts for different purposes, while inheriting the functionality to handle this.

Title:
  inheritance:
    extends: Text

Questionnaire:
  actAs:
    WebEnq4_Template_I18n:
      fields: title
      class: Title
  columns:
    title: string
    active: boolean

The option class: is not required, and will default to Text.

Nota bene: currently, the full class name Title that will be used is hard-coded to Webenq_Model_Title.

Based on the Doctrine I18n behavior, adapted to support a single language table that supports re-use of translations.

package WebEnq4_I18n
author Rolf Kleef

 Methods

__construct

__construct(array $options) : void

Parameters

$options

Get the plugin instance for the I18n template

getI18n() : void

Get localized field string

getTranslation(string $field, string $language) : string

if $language not set, use current language first try to return string in requested language if not succeeded, try to return string language in the first preferredLanguage if not succeeded, try to return string in any language if not succeeded, return empty string

Parameters

$field

string

$language

string

Returns

string

Initialize the I18n plugin for the template

setUp() : void