DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Info | ||
|---|---|---|
| ||
On user ML, Tomislav Preksavec proposed a tool to ease translation: https://lists.apache.org/thread/h0b1bvm7lllgg74xx3kmxc2klj82tw4b |
Introduction
OFBiz is used all over the world by companies doing business in their own country or internationally. This has been recognised early on in the project as being key to the adoption of the project and its works, and to have an internationally diverse community.
...
- entity data translation
- service messages translation
- widget element translation
- content translation
Generic construct of a translation definition
A translation definition is defined in an xml file and governed by the ofbiz-properties.xsd (see https://ofbiz.apache.org/dtds/ofbiz-properties.xsd" ). Translation definitions are also called OFBiz labels, as they are processed through the UiLabelMap services and functionality.
...
<property key="BicycleRack">
<value xml:lang="en">Bicycle Rack</value>
<value xml:lang="en-us">Bike Rack</value>
<value xml:lang="nl">Fietsrek</value>
</property>
Entity data translation
The translation definition for entity data follows the general construct for a translation definition as described in the section above.
...
| Info |
|---|
These translations definitions are used in e.g. selection fields (like of the type check, drop-down, radio), where - to enhance the user experience - rather a descriptive field value of a data record is shown than the id value of that record. E.g. <ProductTypeproductTypeId="1001"description="Fixed Asset Usage"/> |
Service message translation
Service messages, such as error or success messages and others, are generated by functions (in Groovy, Java, Javascript and xml files). These messages are typically shown in log files and through the render engine on screens to the user.
...
| Info | ||
|---|---|---|
| ||
Currently, service message translations are incorporated in:
|
Widget Element Translation
A translation definition can be applied to particular widget definitions, like screen titles, form, grid, field labels, screenlet titles, container and label text, etc. These translation definitions can be applied within both widget definitions in xml files and in Freemarker template (.ftl) files for forms, grids and fields
...
| Info | ||
|---|---|---|
| ||
Translation definitions for widget elements are commonly domain specific, e.g. applicable to accounting, warehousing, sales, etc. |
Field widget title translation
Field widget title translations (aka FormFieldTitle label) are a special case of widget translation definitions as they are related to both related to data records (based on field definitions in entity definitions, included in the <component-entitymodel.xml file in the datamodel component) and a widget element definition as defined in a <DomainOriented>Forms.xml file in the widgets folder in a component, eg PaymentManagementScreens.xml in the accounting component.
...
for the field widget definition without a title element (as in '<field name="productId"><display/></field>)
- the render looks if a default translation definition is available for the field widget (aka the FormFieldTitle translation definition), and if none is available
- show the name of the field widget ("productId") as a label in spaced camel case, meaning 'Product Id"
- for the field widget with a defined title
- (as in <field name="internalName" title="${uilLabelMap.ProductName}"><display"/></field>}, show the translation for the given translation definition (<property key="ProductName"> ..</property>)
- (as in <field name="product" title="${uiLabelMap.Retrieved} ${uiLabelMap.Product}"><display-entity .../><field>, the translations for each of the given translation definitions (<property key=Retrieved"> ..</property> and <property key="Product"> ..</property>)
Content Translation
Translations fo data records as generated through the content component and application is available for specific elements in other components and entities therefrom, e.g. through the association of a content object with a product object, a locale specific content object can be rendered.
How-to ensure localisation is applied to widget elements
Ensuring that the correct translation is applied by the widget engine given the user's locale is achieved through the inclusion of a property-map element in the <actions>..</actions> in a section widget of a screen widget.
...
- the referenced <component>UiLabels.xml file ( "ProductUiLabels", giving ProductUiLabels.xml) in the config folder of the product component
- the map-name, as required by the translation functions in the rendering engine and used in the various widget elements (map-name="uiLabelMap")
Best practice(s) regarding translations
First and foremost, apply common sense when considering to contribute a translation definition to the project. Translation definitions and the applications thereof in OFBiz are intended to:
...