Translation of pagination in Datagrid2

0
Hello everyone, I wanted to change the language of pagination in datagrid2, (English - {1} of {2} to {3} to French - {1} à {2} de {3}) I have tried the batch translation in the language section, but it seems to be working for DataGrid but not for datagrid2 any solution to achieve this behavior. Thanks in advance.
asked
3 answers
1

Hi Chethana,

Translation of DG2 label is not supported by batch translate , but can be done via js 

try this in html snippet setting Javascript 

setTimeout(function() { 
    function translatePagingStatusToFrench() { 
        var pagingStatusElements = document.querySelectorAll('.paging-status'); 
        pagingStatusElements.forEach(function(pagingStatus) { 
            var text = pagingStatus.innerHTML.trim(); 
            var parts = text.match(/(\d+)\s*to\s*(\d+)\s*of\s*(\d+)/); 
            if (parts && parts.length === 4) { 
                var start = parts[1]; 
                var end = parts[2]; 
                var total = parts[3]; 
                var frenchText = `${start} à ${end} sur ${total}`; 
                pagingStatus.innerHTML = frenchText; 
            } 
        }); 
    } 
    
    translatePagingStatusToFrench(); 
    
    var paginationButtons = document.querySelectorAll('.pagination-button'); 
    paginationButtons.forEach(function(button) { 
        button.addEventListener('click', function() { 
            setTimeout(translatePagingStatusToFrench, 500); 
        }); 
    }); 
}, 2000);

 

Hope it helps!

answered
0

Given issue above is working fine in DataGrid but issue is coming for datagrid2 only. Please suggest if any one has implemented this.

image.png

answered
0

You can do so via css. See this doc https://community.mendix.com/link/space/ui-%26-front-end/exchanges/41

answered