Client-side control localization

Calipso provides an easy way of localizing controls' labels.

Localization labels must be created in the server-side as an ASP.NET global resource (ones that are created in the AppGlobalResources_ special folder), usually a RESX file.

The RESX file should be called with the exact name (it's case sensitive!) of the server-side control class name. For example, for a given control class called "MyControl", you'll add a "MyControl.resx" resource file to the App_GlobalResources folder. Like any other ASP.NET application, in order to create resources for different cultures, you would be using the "ControlName.culture.resx" syntax. For example: "MyControl.en-US.resx" or "MyControl.fr-FR.resx".

Very important: please give full culture names to RESX.:
  • YourResxFile.en.resx ===>>> WRONG!
  • YourResxFile.en-US.resx ===>>> OK!

Once RESX files are placed in the right path as described above, Calipso compiles RESX files into JavaScript objects after each Visual Studio project building.

NOTE: RESX TO JAVASCRIPT COMPILER MUST BE INTEGRATED INTO PROJECT'S BUILD PROCESS BY HAND FOR NOW. PLEASE GO TO "YOUR FIRST CALIPSO PROJECT TO GET FURTHER INSTRUCTIONS: Your first calipso project.

Finally, if some control has a Text resource identifier will be available in the client-side in your JavaScript control by calling:
// This code will open a JavaScript alert saying "Hello world!"
alert(this.get_Resources().Text);
$(MSBuildToolsPath)\MSBuild.exe

Last edited Oct 18, 2012 at 9:48 AM by MFidemraizer, version 18

Comments

No comments yet.