institut-de-genomique / Ultimate-DataTable

This AngularJS directive generate a HTML table with build-in fonctionnality like save, edit, remove, pagination etc...
http://institut-de-genomique.github.io/Ultimate-DataTable/
45 stars 26 forks source link

Enable i18n #14

Closed Jenselme closed 8 years ago

Jenselme commented 8 years ago

Hi,

I see that you have i18n capabilities in https://github.com/institut-de-genomique/Ultimate-DataTable/blob/933dc2198518f94f82392822c7a82b5ebf5d34e4/src/services/udt-i18n.js but I fail to see how I can use it. The documentation is not really helping on that issue.

Can you explain this?

galbini commented 8 years ago

Hi,

Yes, we have i18n capabilities but you do not need to do anything. We manage 3 languages : french, english and dutch. The system use your browser settings by default and if a language is not implemented UDT use english.

If you want an another language, we need to implement it in i18n service.

In Javascript we use the next code to detect the language :

navigator.language || navigator.userLanguage

Regards, Guillaume

Jenselme commented 8 years ago

In Javascript we use the next code to detect the language :

navigator.language || navigator.userLanguage

The problem is that it may not detect the language properly. I see here:

 if(this.translateTable[this.preferedLanguage] === undefined){
    this.preferedLanguage = "en";
}

Which means i18n will only be activated if navigator.language returns the lang as a two letter code which is not always the case:

I think you have to modify this code to take into account the dash that may appear in the local on some systems.

ydeshayes commented 8 years ago

Hello,

Can you test the fix ?

thanks for the report !