Skip to content Skip to sidebar Skip to footer

Simple Dojo I18n Implementation

I just recently started learning dojo for personnal use and for experience. So far, I have been doing the tutorials on various dojo stuff (on their website and over the web) and I

Solution 1:

Here's an example of how I have built some dialogs with localization.

directory structure

myApp\
  dialog\
    myDialog.js
    nls\
      dialog.js
      fr-ca\
        dialog.js

myDialog.js

define("myApp/dialog/myDialog", [
  "dojo", "dijit/Dialog", "dojo/i18n", 
  "dojo/i18n!./nls/dialog" // this is a relative path to the 
                           // dialog.js from myDialog.js
], function(dojo, Dialog) {

  var i18n = dojo.i18n.getLocalization(
    "myApp.dialog",  // this is the directory path to the nls folder
    "dialog"         // this is the file
  );       

  return declare(Dialog, {
    title:    i18n.title,
    content:  i18n.content
  });
});

Post a Comment for "Simple Dojo I18n Implementation"