reloading language

reloading language

javismilesjavismiles Posts: 205Questions: 38Answers: 3

Good day, Im using

language: {
url: 'DT/lang/dt'+deflang+'.json'
},

with 3 different json files and it all works well, with 3 different languages

my problem is this, user can logout and login again with different user of different language

and when I use ajax.reload on the table, the table refreshes, but the language does not!
but it should, it should reload the new url,
how can I make it reload? thank u

Answers

  • javismilesjavismiles Posts: 205Questions: 38Answers: 3

    Ive just read in a 2016 message:
    "There is no option to change the language strings after initialisation - sorry."

    I hope that that's not the case... first of all it would be quite absurd, I have implemented myself in a web app with i18n the capability to reload with a different language and it's something really easy to do, so It would not make sense not to have it really...

    you switch the language with
    $.i18n().locale = deflang;
    $('body').i18n();

    and if necessary run an update on the necessary places:

    strNow2 = $.i18n('now');
    strSecond2 = $.i18n('secondleft');
    strSeconds2 = $.i18n('secondsleft');
    strMinute2 = $.i18n('minuteleft');
    strMinutes2 = $.i18n('minutesleft');

    and that's about it, nothing complex really

    it will be a really terrible UX if I have to tell users that to see the new language they have to refresh the entire thing first

  • javismilesjavismiles Posts: 205Questions: 38Answers: 3
    edited August 2018

    mmm Im having the same problem in headers of tables with Im having also with i18n like this

    ...............
    toadd+=$.map(obj.fields, function(obj, index) {
    return '<th>'+$.i18n(obj.d)+'</th>';}).join("");
    toadd+='</tr></thead></table>';
    $("#tables").append(toadd);

    and it all works well, but again, after I logout and login with new user thas has different language, it wont update, to update it I have to refresh the entire page and recreate the table again from the beginning, there must be some way to at least manually resetting those labels to the new i18n language mmm

This discussion has been closed.