In an E-commerce application for example, you may want to give the user some feedback whenever he or she updates the shopping cart. I.e., something like the below message boxes - in the local language of course:
The above images display the text "Shopping cart has been updated" in Norwegian and Swedish respectively. So how is this done?
First you have to make a subfolder called, for example "Scripts" in your project. Inside this folder you store the .js files that I have named "StringResources.js". There should be one .js file per supported language, and they must adhere to the following naming convention:
StringResources.nb-NO.js //Supports Norwegian language
StringResources.en-US.js //US English
and finally there should be a default resource file called StringResources.js - this would typically be in English.
The contents of each file should be something like (with the text translated into the supported languages):
var shoppingCartUpdated = 'Varukorgen har uppdaterats!';
Then what remains is simply to update your .aspx file as follows:
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server" EnableScriptLocalization="true" EnableScriptGlobalization="true">
<asp:ScriptReference Path="~/Scripts/StringResources.js" ResourceUICultures="nb-NO, sv-SE, da-DK, fi-FI, de-DE, fr-FR, nl-NL, en-US, ru-RU" />
The supported languages should be listed, in a comma separated list, as shown. There must be one .js resource file corresponding to each of the listed languages.
You may find more information in Imar Spaanjaars blogpost.
And that is pretty much it - happy programming :)
Here's a short little BLOGGER BIO to tell you a little bit about my background - and why I chose to get into programming and SEO.
I grew up in Norway, but went to school in the U.S. I have a degreen in computer science from Arizona State University. After graduating I moved back to Norway where I got a job working at Norwegian Data and later IBM. I went on to do a Masters of Management at BI in Oslo. After several years as a senior executive at IBM I decided to start my own company, Apropos Internet. In 2004 I started Virosafe Norway, a company that imports and distributes data security products, and now I am CEO of Lumino as well.
It's always been essential for me to stay up to date on the latest trends and developments in technology - not only to stay current as a programmer, but also to ensure my success as an entrpreneur. Lumino blog articles contain a variety of topics that have been useful for my own businesses - perhaps you will find them useful as well.
© powered by Lumino