Lumino - veibeskrivelse
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 :)
Her er en rask liten BLOGGER BIO for å fortelle litt om min bakgrunn - og hvorfor jeg valgte programmering som fagfelt.
© powered by Lumino