Localisation

It can be done by assigning a function to
Settings.GetText
, this function will receive 2 parameters (name of the helper and name of the property) and must return a string, example:
   Settings.GetText = GetTranslate;   
...
private static string GetTranslate(string type, string key)
{
    // type can be "Grid", "MultiLookup", "PopupForm", etc.
    switch (key)
    {
        case "CancelText": return Mui.Cancel;
        case "YesText": return Mui.Yes;
        case "NoText": return Mui.No;
        case "MoreText": return Mui.more;
        case "SearchText": return Mui.Search;
        case "GroupBarText": return Mui.GroupBarText;
    }

    return null; // leave default
}
To localize texts from
awem.js
(mods), you need to set
awem.clientDict
, if you open
awem.js
you can see the default values:
var clientDict = {
    GridInfo: "of {0} items",
    Select: 'please select',
    SearchForRes: 'search for more results',
    Searchp: 'search...',
    NoRecFound: 'no records found'
};
So for example it could be set like this:
awem.clientDict = @Html.Raw(Json.Encode(ClientSideUtils.GetClientDict()));
You could also reference a different js file depending on the current ui language, and in that file you would set
awem.clientDict
. For a localisation demo you can have a look, and download the source code of the prodinner demo.



Comments