SimonbJohnson / quickX3

HXLDash. Create data visualisations quickly by leveraging the humanitarian exchange language
https://hxldash.com/
MIT License
8 stars 4 forks source link

[a11y][i18n] Option to specify an default language when creating a new dashboard #74

Open fititnt opened 4 years ago

fititnt commented 4 years ago

Refs:


At this moment is not possible to explicitly specify an default language of and dashboard. On this issue my suggestion is

  1. To allow the user decide which language would want to set as default.
  2. 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()

Captura de tela de 2020-04-16 15-44-30