Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
{warning}Updated i18n functionality requires FarCry
Wiki Markup
Warning

Updated i18n functionality requires FarCry 4.1.

{warning} h2. Overview {excerpt} The webtop and COAPI (meaning all forms that use formtools) have been updated so that every label is translated. {excerpt} * Resource bundles in core, plugins and project are loaded. Core resources are overridden by plugin resources, plugin resources are overridden in as they are defined in the farcryInit tag (last overrides first), and project resources override all. * Locales available in the application now get defined in the farcryInit tag (locales attribute) * Webtop localisation has been refactored * COAPI localisation - property labels, fieldsets, steps, etc are now translated * [Resource Bundle Plugin] * Resource bundles for core, common plugins, projects * Engage community for translations h3. Accessing the resource bundles Webtop and form assets will be hooked into the resource bundles automatically, but when you need to do that in your own code you use these methods. h4. getResource(key, default, locale) || Argument || Description || Default Value || | key | The key being requested | For consistency should be in the form category.subcategory.item@attribute, e.g. myplugin.thatform.thisdescription@text | | default | The default value (used if the key isn't found) | The key string | h4. formatRBString(rbString, substituteValues, default) || Argument || Description || Default Value || | rbString | The key being requested. Not changed to key for backwards compatability | See getResource | | substituteValues | Either a simple value to replace one value or an array to replace several. Variables defined in the resource string as {1} ... {n} | | default | The default value (used if the key isn't found) | The key string | h3. Webtop Previously the webtop was translated by setting the label attribute in the xml to a variable (refering to the resource bundle struct in memory). With the refactoring, the label attribute is used to specify the DEFAULT VALUE. If the menu item has no corresponding resource, the default will be used. If it does it will be translated. This process also applies to the [Inline Documentation] feature. By default the menu item is mapped to a resource key in the format webtop.sectionid.subsectionid etc. The attribute is then added to this base key to differentiate it from other translated attributes. e.g. webtop.sectionid.subsectionid@label. The base key used for a menu item can be overridden by setting the rbkey attribute. This means that if you have an equivelent item in two places on your webtop you can override one to refer to the other. NOTE: this is not recommended - context is a significant factor when translating. h3. COAPI Translations of type, rule, and form text can currently be accessed through various i18n methods. In most cases these won't be necessary as all formtool tags are now automatically

Overview

Excerpt

The webtop and COAPI (meaning all forms that use formtools) have been updated so that every label is translated.

  • Resource bundles in core, plugins and project are loaded. Core resources are overridden by plugin resources, plugin resources are overridden in as they are defined in the farcryInit tag (last overrides first), and project resources override all.
  • Locales available in the application now get defined in the farcryInit tag (locales attribute)
  • Webtop localisation has been refactored
  • COAPI localisation - property labels, fieldsets, steps, etc are now translated
  • Resource Bundle Plugin
  • Resource bundles for core, common plugins, projects
  • Engage community for translations

Accessing the resource bundles

Webtop and form assets will be hooked into the resource bundles automatically, but when you need to do that in your own code you use these methods.

application.rb.getResource(key, default, locale)

Argument

Description

Default Value

key

The key being requested

For consistency should be in the form category.subcategory.item@attribute, e.g. myplugin.thatform.thisdescription@text

default

The default value (used if the key isn't found)

The key string

application.rb.formatRBString(rbString, substituteValues, default)

Argument

Description

Default Value

rbString

The key being requested. Not changed to key for backwards compatability

See getResource

substituteValues

Either a simple value to replace one value or an array to replace several. Variables defined in the resource string as {1} ... {n}

default

The default value (used if the key isn't found)

The key string

Webtop

Previously the webtop was translated by setting the label attribute in the xml to a variable (refering to the resource bundle struct in memory). With the refactoring, the label attribute is used to specify the DEFAULT VALUE. If the menu item has no corresponding resource, the default will be used. If it does it will be translated. This process also applies to the Inline Documentation feature.

By default the menu item is mapped to a resource key in the format webtop.sectionid.subsectionid etc. The attribute is then added to this base key to differentiate it from other translated attributes. e.g. webtop.sectionid.subsectionid@label.

The base key used for a menu item can be overridden by setting the rbkey attribute. This means that if you have an equivelent item in two places on your webtop you can override one to refer to the other. NOTE: this is not recommended - context is a significant factor when translating.

COAPI

Translations of type, rule, and form text can currently be accessed through various i18n methods. In most cases these won't be necessary as all formtool tags are now automatically translated.