-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Refs:
At this moment is not possible to explicitly specify an default language of and dashboard. On this issue my suggestion is
- To allow the user decide which language would want to set as default.
- Use this information to set any element that is a conteiner of the dashboard to that language
Smart suggestions
Since the idea behind the hxldash is be quick and smart, there is something that is possible to implement by default: guess the languages that the user browser is using, and prefer use these languages. Still a good idea allow user specify other, but can be used as default.
This may not be perfect (for example, an user who works with English a lot may actually change languages all the time) but for non-English speakers the fact that they go to the dashboard and somewhat it even suggest their language.
JS to use for debugging
here a quick vanila JS to do testing on this. Some languages have lots of characters, so if want just use the main 2 letters, this one helps do this.
// used on https://github.com/fititnt/ais-ethics-tags/blob/master/assets/js/ais-ethics-tags.js#L455
// public domain, dont need to cite
function whoAmI () {
let me = {};
me.myLanguage = navigator.language || navigator.userLanguage;
me.myLanguagesOriginal = navigator.languages || [me.myLanguage];
me.myLanguages = [];
me.myLanguagesOriginal.forEach(function(lang) {
let wdLang = lang.split('-');
if (me.myLanguages.indexOf(wdLang[0]) === -1) {
me.myLanguages.push(wdLang[0]);
}
})
return me;
}
whoAmI()
