UserFrosting
UserFrosting copied to clipboard
UF's language codes do not always map to valid HTML lang codes
In https://github.com/userfrosting/UserFrosting/commit/0ba8ab4ce6bca724b07d118c90e3692cbf465520#diff-0ec1ca6d6c0abd16b8fdf4a504f04f77d102a96c10d53404405c2649a2bb8e4c we change the lang
attribute of the top-level html
tag in the core base template from a hardcoded value of en-US
to a dynamic value pulled from the user's language/locale.
The problem is that our internal language codes are not always valid lang
codes as per https://www.w3.org/2005/05/font-size-test/starhtml-test.html:
Notably, most of our localized codes are invalid because of the underscore. We should either change our naming schema to match RFC 3066 (which would be a breaking change) or find a way to define the corresponding lang codes. One possibility would simply to define them with a custom language key.
One possibility would simply to define them with a custom language key.
That would be the easier solution.
Odd, I thought we were swapping the underscore for a dash. Something might have broke, or I'm remembering wrong. Custom language key would be the most reliable option I think.