quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.77k stars 3.5k forks source link

Error using htmlAttr for lang attribute #7674

Closed jraez closed 4 years ago

jraez commented 4 years ago

Describe the bug When using Meta plugin, changing the "lang" attribute of the html does not work.

Codepen/jsFiddle/Codesandbox (required) https://codepen.io/jraez/pen/XWdpBpO

To Reproduce Steps to reproduce the behavior:

  1. Go to the Codepen provided
  2. inspect the result in your browser (the html tag of the iframe) ; html tag should have "lang" and "locale" attributes set to 'en-us'
  3. Click on "change locale" button
  4. inspect the result in your browser, locale attribute has changed to "fr", not lang.

Expected behavior html "lang" attribute should be "fr"

Platform (please complete the following information): OS: Windows, Linux Node: 14.8 NPM: 6.14.7 Browsers: Chrome, Firefox

Additional context Using "document.documentElement.lang" to set lang manually works fine.

rstoenescu commented 4 years ago

Hi,

The "lang" attribute is managed by the Quasar language pack that you've set. It is ignored when using the Meta plugin.

jraez commented 4 years ago

Thanks for the answer.

I don't use the language pack because it does not support all languages that I need. In our case, every component's label or errors are translated with Vue-i18n.

So, I got the restrictions of the language pack without using it.

I'll not argue against such design, I respect the developer's choices but could it be explained in Meta plugin documentation?

Also, is there any side effect to set it manually through "document.documentElement.lang"?

rstoenescu commented 4 years ago

There's no side-effects in setting it manually.

Since we are open-source, it would be nice if you or your team would PR the missing languages that you need (ping me if you need any help with that). You'd give a little back to the framework that helps you and the whole framework community could benefit from your contributions. A win-win.

jraez commented 4 years ago

I would love to do the PR but unfortunately, translations came from our clients, so we don't master ourselves such languages.

Thanks for the help and thanks for the great work on Quasar.

rstoenescu commented 4 years ago

We might request the community to help with the language packs then. What languages are missing?

jraez commented 4 years ago

So, our client requested our website to be available 13 languages, here the list of ones that are not in quasar:

Albanian (AL) Bosnian (BA) Greek (GR) Montenegrin (ME) Macedonian (MK) Serbian (RS)

Digging the git, I noticed that Slovenian is here as "sl.js" but according to Wikipedia, the ISO 3166-2 code for Slovenia is SI, not SL, SL is for Sierra Leone.

https://github.com/quasarframework/quasar/blob/dev/ui/lang/sl.js

https://en.wikipedia.org/wiki/ISO_3166-2:SI https://en.wikipedia.org/wiki/ISO_3166-2:SL

metinjakupi commented 1 year ago

up?

metinjakupi commented 1 year ago

I need to implement the Macedonian Language and we have created the .mjs file @rstoenescu , should i create a PR for that?

rstoenescu commented 1 year ago

@metinjakupi Yes, please do. Thanks!

For others reading this: if your desired language pack is missing, just create a PR with it.