Globalization Guidelines

Authors:Adam Peller


Dojo addressed the globalization features at the very beginning of its development. This document presents the rules and describes how to use these features to globalize your Web applications based on Dojo version 1.0. Each of the rules use one of the following directive words:

  • Must: You must always follow the rules; otherwise your application cannot be globalized.
  • Should: You are recommended to follow the rules in some situations. Your application can be globalized if you do not follow these rules, but more effort might be needed.
  • May: These rules do not affect the capability of globalization. You can choose whether to follow them or not.

Use the following guidelines to implement internationalization.

String Manipulation Guidelines

  • You should use the Js2Xlf tool to convert JSON files into XLIFF files for translation.
  • You should deal with free text using ICU library at the server side.
  • You should use only casing functions for locale neutral situation.
  • You should not use locale sensitive casing functions provided by JavaScript.
  • You should always escape a string as a whole rather than character by character.
  • You should not use any comparing, searching, or replacing functions for strings that might contain combining character sequences.
  • You should not use inserting, removing, or splitting functions for strings that might contain special characters.
  • You should not use trimming functions for strings that might contain special characters.
  • You should not use counting functions for strings that might contain special characters.
  • You must check the return value of String.charAt() when the string contains surrogates.

Formatting and Validation Guidelines

  • You must use dojo.string.substitute() to generate text output rather than simply use “+” between strings.
  • You must use Dojo format functions to convert locale sensitive data into text.
  • You must use Dojo validating and parsing functions to convert text from the users’ input into data.
  • You should not hard-code patterns and locales when formatting data.

Dijit Widgets Guidelines

  • You should not specify both the height and the width of a widget to be translated by numeric units.
  • You must ensure that all resources used in widgets are localizable.
  • You should consider BiDi support in development and customization.
Error in the documentation? Can’t find what you are looking for? Let us know!