Skip to content
cindyskach edited this page Jun 27, 2011 · 24 revisions

#Globalization

About This Page

Contains a proposal on how to approach Globalization for the Maqetta code base so that localized strings can be used instead of the current hard-coded English strings.

Setting the Locale

While it was suggested not to decide this right now, two possible solutions are available here for setting a locale. Based on the information on that site, if no locale is specified then the default locale of the browser will be used, which is probably not a good approach in the long run.

Notes on Files

Width needs to be changed to work with different languages

  • davinci/actions/SelectThemeAction.js
  • davinci/actions/OpenThemeEditor.js
  • davinci/ve/input/BorderContainerInput.js
  • davinci/ve/input/DataGridInput.js

Yet to be globalized since they're still being worked on

  • davinci/actions/saveAsWidget.js
  • davinci/ui/SaveAsWidgetForm.js

Uses other files for globalization

  • davinci/ve/palette -- common.js
  • davinci/ve/prefs -- common.js

###Files that don't appear to be used yet

  • Some of the files in davinci/ve/widgets (like Background.js and Border.js) don't seem to be used outside of this widgets folder. They look like they might one day be used in davinci/ve/views/SwitchingStyleView.js

Removed Files

  • davinci/ve/actions/ChildActions.js
  • davinci.review/WebContent.davinci.review/actions/ExplorerAction.js

Files with strings I cannot seem to find in the UI

  • davinci/Workbench.js -- "Select Editor" -- commented out and edited
  • davinci/Runtime.js -- "Careful! You are about to leave daVinci." -- globalized
  • davinci/ve/Context.js -- "Careful! You are about to leave Maqetta." -- commented out
  • Strings in ui/Panel.js-- strings aren't used, and they're noted as such though not commented out
  • Strings in ve/HTMLVisualEditor.js -- commented out since the strings since no longer used

###Files that aren't used

  • ui/templates/downloadSelected.html
  • davinci/review/WebContent/davinci/review/actions/SubmitDraftAction.js - used in review_plugin.js but commented out

Localization Inventory (Incomplete)

I've marked things I believe I have completed -- unless I missed a string somewhere.

Maqetta palettes

  • SwitchingStyleView.js -- the Properties palette
  • Files in the widgets folder such as Background.js, Border.js, BorderRadius.js, etc. (didn't actually do Background.js, Border.js and BorderRadius.js in ve/widgets/ since they're currently not being used, but I did the others)

The palettes on the left and right side of the Maqetta user interface

Maqetta plugins (postponed)

ui_plugin.js, ve_plugin.js, review_plugin.js, themeEditor_plugin.js
These files contain the strings the user sees the most when using Maqetta.

Maqetta dialogs

  • File dialogs in Resource.js
  • Files containing alerts, prompts and dialogs such as newTheme.js, Runtime.js, StateActions.js, BorderContainerInput.js, etc.

###Widget metadata

  • widgets.json
  • *_oam.js files

###Widget metadata helper files

  • Need to inventory *helper.js files in the metadata folders -- didn't find any

###Smart input helper files

  • davinci.core/WebContent/davinci/ve/input/* - I see a string in DataGridInput.js, probably other files also have strings

###Theme metadata (e.g., davinci.dojo_1_7/WebContent/maqetta/themes/claro/*)

  • *.theme files (e.g., claro.theme)
  • *.json files (e.g., claro.json)

###Main file

  • davinci.core/WebContent/pagedesigner.html might have a couple of strings

###Review and commenting (davinci.review project)

  • davinci.review/WebContent/review.html might have a couple of strings
  • davinci/review/actions/*.js
  • davinci/review/widgets/*.js
  • davinci/review/view/*.js
  • davinci/review/*.js -- formHtml in Review.js
  • davinci/review/util.js

###Mobile previewer code

  • davinci.core/WebContent/preview.html might have a couple of strings
  • davinci.core/WebContent/preview/singlepreview.js has a couple of strings

###Various files need to be totally replaced for localized versions

  • All of the welcome.html files
  • All of the welcome_to_maqetta.html files (e.g., davinci.core/WebContent/ve/resources/welcome_to_maqetta.html)
  • davinci.core/WebContent/workspace/app.css
  • Localized davinci.core/WebContent/samples/*.html? Probably not, but would be good to have things set up so that product teams could have localized versions if they so wanted

###Templates

  • ui/templates/*.html
  • davinci.review/WebContent/davinci/review/widgets/templates/*.html

###Need to study the davinci.core/WebContent/eclipse/* folder

  • to see if anything there needs to be localized -- doesn't look like there is

Maqetta Palettes and Maqetta Dialogs

Creating Resource Bundles

Resource bundles will be written in the JSON format. Each resource bundle pertaining to each locale will be in its specific locale folder. These locale folders will be contained in a folder named "nls"

Dojo Commands to Extract Localized Info

dojo.require("dojo.i18n");
dojo.requireLocalization("directory.containing.nls.folder","resourceBundleName");
dojo.i18n.getLocalization("directory.containing.nls.folder","resourceBundleName");

Implementation

Going off of some of Adam Peller's Dojo documentation found here, the basic idea will be to assign the localized resources returned by dojo.i18n.getLocalization to an object. We could then access the appropriate resources through the object.

If we were to localize the strings in the Properties Palette and store them in a Resource Bundle called "common," the code might look something like:

dojo.require("dojo.i18n");  
dojo.requireLocalization("davinci.ve", "common");  
var langObj = dojo.i18n.getLocalization("davinci.ve", "common");  
...  
{title:langObj.common,//the title would then be "Common" if in English  
...  
{title:langObj.widgetSpecific,//the title would then be "Widget-specific" if in English  
...

Widget Metadata

To be determined -- Most likely OpenAjax's syntax for message bundle files in xml or json

Maqetta Plugins

Globalization postponed until a later date.

Where to Begin the Globalization Process

Maqetta palettes

  • SwitchingStyleView.js -- the Properties palette
  • Background.js -- the Background properties
    The palettes on the left and right side of the Maqetta user interface

Maqetta dialogs

Clone this wiki locally