Localization

ParamQuery Grid offers powerful localization capabilities, allowing all text strings to be customized for any regional language. To enable localization, simply include the relevant JavaScript file for the desired language.

In the provided example, localization strings are dynamically updated based on the selected language from a dropdown menu. The language change is handled by incorporating localization files and configuring the locale option through the dropdown's change event.

Select Locale:
Albums Feed Reader
Title
Rights
Price
Content
Artist
 
 
 
 
 
 
No rows to display.
Loading...


53
 
1
2
    $(function () {
3
4
        var colModel = [
5
        { title: "Title", dataType: "string", width: "150", dataIndx: 1 },
6
        { title: "Rights", dataType: "string", width: 150, dataIndx: 2 },       
7
        { title: "Price", dataType: "float", width: 70, dataIndx: 3, format:'#.00' },       
8
        { title: "Content", width: 320, dataIndx: 4, dataType: 'html' },
9
        { title: "Artist", dataType: "string", width: 120, dataIndx: 0 }
10
        ];
11
12
        var dataModel = {
13
            cache: true,
14
            location: "remote",
15
            dataType: "xml",
16
            getUrl: function () {
17
                return { url: "/Content/apple-albums.xml" };
18
            },
19
            getData: function (dataDoc) {
20
                //debugger;
21
                $(dataDoc).find("price").each(function(i,pNode){
22
                    var txt=$(pNode).text();
23
                    txt=txt.replace("$","");
24
                    $(pNode).text(txt);                    
25
                });
26
                var obj = { itemParent: "entry", itemNames: ["artist", "title", "rights", "price", "content" ] };
27
                return { data: $.paramquery.xmlToArray(dataDoc, obj) };
28
            }
29
        };
30
31
        var obj = { 
32
            height:'flex',
33
            width: 700,
34
            dataModel: dataModel,
35
            colModel: colModel,
36
            title: "Albums Feed Reader",
37
            scrollModel: {autoFit: true}
38
        };
39
        obj.pageModel={
40
            type:"local",
41
            rPP:2,
42
            rPPOptions: [1, 2, 5, 10, 20, 100]
43
        };
44
45
        var $grid=$("div#grid-localize").pqGrid(obj);             
46
47
        $("#select-locale").change(function(evt){
48
            var locale=$(this).val();
49
            $grid.pqGrid("option", "locale", locale );
50
            $grid.pqGrid("refresh" );
51
        });
52
    });    
53
ParamQuery Pro Eval