View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


Mobile Internationalization



Openbravo mobile application can (and should) be designed in a way that allows them to be internationalized.

Localized Texts

The translation of mobile applications is based on Messages defined in the backend.


These messages are used to display not only actual messages but also any label that appears in the UI.

Translating this messages to different languages and creating translation modules is achieved in the same way any other Openbravo module is localized. For more detailed information read the section in Localization Guide covering this topic.

The way to obtain a localized message in the front-end is:


Where myLabelSearchKey is the Search Key of the message that will be replaced by its text.

Available Labels

Not all messages defined in the backend are loaded in client side. By default, the loaded labels are:

DOs and DON'Ts

The object containing all the messages is loaded in the client side after loading all static resources, but before the login. At this first load, default language is used for the labels. When the user login, labels are loaded again with the proper session language. Because of this, follow this guide:

  content: OB.I18N.getLabel('MYMOD_Label'); // At this point, the label is still not available
  initComponents: function () {
    this.setContent(OB.I18N.getLabel('MYMOD_Label')); // At this point labels are loaded
  kind: 'OB.UI.Button',
  i18NLabel: 'MYMOD_Label' // 'MYMOD_Label' search key is replaced with the actual text
  name: 'MYMOD.MyComponent',
  i18NLabel: '',
  initComponents: function () {
 Messages in the backend:
   Search Key: MYMOD_LinesUpdated
   Message Text: Lines updated
   Search Key: MYMOD_And
   Message Text: and
   Search Key: MYMOD_LinesUpdated
   Message Text: lines deleted.
// INCORRECT CODE: Do not use in this way
  initComponents: function () {
    this.setContent(5 + OB.I18N.getLabel('MYMOD_LinesUpdated') + ' ' + OB.I18N.getLabel('MYMOD_And') + 2 + OB.I18N.getLabel('MYMOD_LinesUpdated'));
 Result: 5 Lines updated and 2 lines deleted.
 Messages in backend:
   Search Key: MYMOD_LinesUpdatedAndDeleted
   Message Text: %0 Lines updated and %1 lines deleted.
   Message Text (Spanish translation): Se borraron %1 líneas y se actualizaron %0,
// BETTER CODE: Do use in this way
  initComponents: function () {
    this.setContent(OB.I18N.getLabel('MYMOD_LinesUpdatedAndDeleted', [5, 2]));
 Result: 5 Lines updated and 2 lines deleted.
 Result (Spanish): Se borraron 2 líneas y se actualizaron 5. <- Note the order of the parameters has been switched in this case

Other Internationalizable Objects

In addition to localized labels, the client's OB.I18N object exposes some other methods to facilitate internationalization. The result obtained when these methods are invoked is determined by the System locale configuration.

> OB.I18N.formatCurrency(8000)
> OB.I18N.formatRate(5.666)
> OB.I18N.formatDate(new Date())
> OB.I18N.formatHour(new Date())

OB.Format contains all different available numeric and date formats.

Retrieved from ""

This page has been accessed 4,071 times. This page was last modified on 23 April 2013, at 10:34. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.