Dojo Globalization
Since adopting the Dojo Toolkit in 2006, IBM has made significant contributions to its capability to support multiple languages and cultures. IBM's goal was to architect Dojo so that globalization is a basic feature of the core toolkit and its Dijit widget set. Dojo has become the first open source Javascript toolkit to integrate support for language and cultural conventions as well as bidirectional rendering. Dojo is the first toolkit with these critical capabilities and remains the only toolkit that is fully enabled for globalization.
The IBM Dojo team began by incorporating the Common Locale Data Repository (CLDR) in Dojo. CLDR, which provides key building blocks for software to support the world's languages, is the largest and most extensive standard repository of locale data available. It is maintained by the Unicode CLDR Technical Committee, which has a process for data collection, resolution, public feedback, and release from contributors world-wide. The committee then vets for adoption, new information from contributors against the best available existing information.
The dojo.cldr subdirectory is a transformation of the CLDR into JavaScript, which makes culturally-sensitive information available in many languages, for the presentation of dates, numbers and currencies. It does this by using a system for loading translated strings dynamically to the web page. IBM's Globalization Architecture team and the IBM China Development Lab contributed to the maturity of these technologies. Their work together made huge strides in the Dijit widgets' globalization.
Fig. 1 - dijit.Calendar
(Click the image to enlarge it.)
Fig. 2 - Calendar in Chinese
(Click the image to enlarge it.)
Fig. 3 - Islamic Calendar in English
(Click the image to enlarge it.)
For example, IBM's contribution enabled Dojo's dijit.Calendar widget to conform to the conventions of dozens of languages and hundreds of locales. Translated month and day name abbreviations are used, the widget layout is made flexible to accommodate variable length strings, the first day of the week is chosen to match regional norms, the year and rendering of the full date is done according to cultural conventions, and double-byte character sets are honored. With the Calendar widget, users can select dates, as shown in Figure 1.
The widget has the following globalization features. Firstly, calendars can be presented with different variations such as the translations of the month names, the day abbreviations, the formatting of the year, and the way the full date is formatted. Figure 2 shows Chinese translations for the month and day names as part of the calendar widget, as well as the year, which in Chinese has 'nian' after the number.
Secondly, cultural information, such as the abbreviations and the date formats, is well formatted. The Dojo Calendar widget can map the Gregorian calendar to corresponding non-Gregorian ones where the date values are quite different as shown in Figure 3.
The flexibility of the Dojo Calendar widget's layout allows its use in bidirectional (BiDi) language rendering and filled-in variable length strings. The widget deals with the right-to-left languages (widely used in most Middle East countries) by mirroring the entire user interface. Not only are the individual strings rendered from right to left, the days in the calendar actually flow from right to left as well, and the next and previous buttons are flipped in position. The Hebrew calendar implementation can also incorporate a special numbering system using Hebrew characters instead of digits. Figure 4 shows the traditional Hebrew calendar rendered in the Hebrew language.
IBM's contribution to the Calendar widget was truly a worldwide effort. The Arabic Competence and Globalization Center in Egypt developed the initial logic for the calendar conversions. The BIDI Development Lab in Israel helped bring the code to maturity and integrate it with the dijit.Calendar. Developers in Thailand created a Buddhist implementation once the framework was set. And the China User Technology Globalization Development team helped to implement the mapping from CLDR to each Calendar phase. All three calendars are now available in Dojo, although some are still experimental and are works-in-progress.
Although we've focused on the calendar widget as the example of Dojo's globalization capabilities, the core widgets in Dojo and the Dijit widget library are all fully globalized. They are able to display the appropriate date and time formats, currency, number formats, etc. for a user's specific locale, as well as handle bidirectional languages such as Arabic and Hebrew.
The result of this effort: it's easy for those developing in Dojo to ensure that the presentation to the user never assumes one particular language or culture and their applications feel natural around the globe.




