Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fititnt opened this issue Apr 16, 2020 · 0 comments

Comments

@fititnt
Copy link
Contributor

fititnt commented Apr 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant