We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Global locale does not work on certain pages

My application have 4 pages that use Grid and just one of them don't work properly. 
Obs: the one that not work uses datePicker and AutoComplete as well.

The configuration of locale is set at the start of the application in the app.js when Site.Master

Setting Locale

Grid config

Grid

The configuration of datePicker and AutoComplete does not have the locale property as well.

Here is a proof that the locale is not being load properly

debug
The other 3 pages when debugged the grid.locale shows "pt".


Don't know how to proceed.


3 Replies

PS Pavithra Subramaniyam Syncfusion Team April 4, 2019 05:38 PM UTC

Hi Adam, 
 
Thanks for contacting Syncfusion support. 
 
QueryMy application have 4 pages that use Grid and just one of them don't work properly.  
Obs: the one that not work uses datePicker and AutoComplete as well. 
 
We have checked your query and tried to reproduce the issue, but it is unsuccessful. We have prepared a sample based on your requirement where the locale property is set to Grid, AutoComplete and DatePicker components in all 4 content pages. Please refer the below code example and sample link. 
 
[Site.Master] 
<script type="text/javascript">  
             
            ej.base.L10n.load({ 
                'pt': { 
                    'grid': { 
                        'EmptyRecord': 'Nao existem dados para exibicao' 
                    }, 
                    'pager': { 
                        'currentPageInfo': '{0} de {1} paginas' 
                    }, 
                    'datepicker': { 
                        'placeholder': 'selectione a data' 
                    }, 
                    'numerictextbox': { 
                        'incrementTitle': 'incrementar valor' 
                    }, 
                    'dropdowns': { 
 
                        'noRecordsTemplate': 'Nenhum registro foi encontrado', 
 
                        'actionFailureTemplate': 'A solicitação falhou' 
 
                    } 
                } 
            }); 
 
        function loadCultureFiles(name) {  
        ej.base.setCulture(name);  
        var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];  
        if (name === 'pt') {  
            files.push('numberingSystems.json');  
        }  
        var loader = ej.base.loadCldr;  
        var loadCulture = function (prop) {  
            var val, ajax;  
            if (name === 'pt' && prop === files.length - 1) {  
                ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/supplemental/' + files[prop], 'GET', false);  
            } else {  
                ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false);  
            }  
            ajax.onSuccess = function (value) {  
                val = value;  
            };  
            ajax.send();  
            loader(JSON.parse(val));  
        };  
        for (var prop = 0; prop < files.length; prop++) {  
            loadCulture(prop);  
        }  
    }  
  
    document.addEventListener('DOMContentLoaded', function () {  
        loadCultureFiles('pt');  
            });  
 
        </script> 
 
Content pages : [Default, About, Contact, WebForm1.aspx] 
<div id="Grid1"></div> 
    <script type="text/javascript"> 
        ej.grids.Grid.Inject(ej.grids.Page, ej.grids.Edit, ej.grids.Group, ej.grids.Toolbar); 
        var data = [{ 
            'OrderID': 10248, 
            'CustomerID': 'VINET', 
            'OrderDate': '1996-07-04T00:00:00.000Z', 
            'Freight': 32.38 
        }, 
                 .  .  .  . 
]; 
        var grid = new ej.grids.Grid({ 
            dataSource: data, 
            gridLines: 'Both', 
            height: '300px', 
            locale: 'pt', 
            editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, 
            toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'], 
            columns: [ 
                { field: 'OrderID', headerText: 'Order ID', isPrimaryKey: true, textAlign: 'Right', width: 120 }, 
             .  .  .  . 
            ] 
        }); 
        grid.appendTo('#Grid1'); 
    </script> 
 
    <input id="autocomplete1" /> 
    <script type="text/javascript">         
        var auto = new ej.dropdowns.AutoComplete({ 
            locale: 'pt' 
        }); 
        auto.appendTo('#autocomplete1'); 
    </script> 
 
    <input id="datepicker1" class="col-lg-12 control-section" /> 
    <script type="text/javascript"> 
        var datepicker = new ej.calendars.DatePicker({ 
            locale: 'pt' 
        }); 
        datepicker.appendTo('#datepicker1'); 
    </script> 
 
 
 
 
Could you please provide more details about your issue that will be helpful for us to provide a better solution as early as possible 
 
Regards, 
Pavithra S. 



AM Adam Mews April 5, 2019 04:27 PM UTC

Thanks for response! 

I solved the problem removing the <script> containing the ej2.js from my header... It was overwriting the localization configs that was made.

Problem solved!


PS Pavithra Subramaniyam Syncfusion Team April 8, 2019 04:54 AM UTC

Hi Adam, 
 
Thanks for contacting Syncfusion support. 
 
We are happy to hear that your issue has been resolved. 
 
Please contact us if you need any further assistance. 
 
Regards, 
Pavithra S. 


Loader.
Live Chat Icon For mobile
Up arrow icon