Want to specify lang "en" (not en-us or en-gb)
-
I am doing i18n work in my quasar app (using vue-i18n) and we have decided internally to not use regional language definitions but instead only top level (ie
en
overen-us
). The problem is that Quasar’s built-in lang switching only hasen-us
oren-gb
, and this is messing up my switching, as when I switch toen
in my components, there is a quasar console error and any Quasar provided translation (like date month names) fails. Do I need to make a request in github for Quasar to include a simple top levelen.js
file in its lang file? Or is there somewhere I can simply define my en to fallback to Quasar’sen-gb
file in the absence ofen
? Or should I do something else? Renamingquasar/lang/en-gb.js
toen.js
is a workaround, but obviously it will be obliterated on the next quasar update, so this is not a good solution. -
I don’t know if this is a solid solution but i also had to get en as result from getLocale so i did this in locales getters:
export function getLocale(state) { if (state.locale === 'en-us') { return 'en' } else { return state.locale } }
-
Thanks for the response I will look into it more closely. But I am not sure it solves my particular problem which is that my app (and all language related things in it) must use ‘en’, but the core language choices of Quasar (which affect the components that Quasar itself uses/provides) does not include ‘en’, so my language is ignored by Quasar unless I make my hacky workaround above.
-
I have actually been rethinking this (and my company’s take on it) over the past few hours and have concluded that it actually does make sense to base our language (in English anyway) on one of the regional sets. So I will adjust my code to base on en-GB and leave it at that (although I will output the language label as simply “English”.