Localization and Globalization

DTML.org platform is used by the teachers and students from more that 120 countries and thus needs to be properly localized and globalized

Resource strings

All strings used in the code should come from resource files. Resources are assembled in *.resx files located in DTML.Resources project. All English strings should be entered into Resources.resx file.

In you can reference strings from resource files. C# Example:

var myText = Resources.Resources.YourString;

JS Localization

Sometimes you need to use string directly in JavaScript, not in the controller or in the view. For that purpose we use JSResources.cshtml view which is referenced on master layout. All string from Resources.resx are automatically available in your JavaScript code via window.Resources object.

No extra code is needed. JS Example:

toastr.warning(window.Resources.CustomizedURLLimitReached);

Automatic Resource Translation

We are using Bing Translator API for localizing resource strings. To run automatic translation, please use ResxTranslator utility: $..\DTML.BuildTools\ResxTranslator\bin\Debug\ResxTranslator.exe

  1. Select .resxFile radio button option

  2. Click [...] to navigate and select Resources.resx file

  3. Click "Start Translation" button

Last updated