Set datable language option to multi lang based on the locale variable

Set datable language option to multi lang based on the locale variable

FranckFFranckF Posts: 1Questions: 1Answers: 0

Hi team,
this is a conceptual question:
is it possible to set "language" on the locale variable to provide multi lang?
All I foundin forum is how to set only one language based on a url or hardcoding in js.

Answers

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin

    It certainly is, although the exact way to do it will depend upon your setup. For example, you might want to have a "DataTables dictionary":

    var dtDic = {
      en: { ... },
      fr: { ... },
    };
    

    Then you'd use language: dtDic[locale] in your DataTables initialisation.

    If you have all the language files for DataTables being Ajax loaded, then you could include the locale in the URL (as a parameter or part of the path, depending on how you have things set up).

    Allan

Sign In or Register to comment.