No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Want to specify lang "en" (not en-us or en-gb)

    Framework
    2
    4
    350
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ssuess
      ssuess last edited by ssuess

      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 over en-us). The problem is that Quasar’s built-in lang switching only has en-us or en-gb, and this is messing up my switching, as when I switch to en 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 level en.js file in its lang file? Or is there somewhere I can simply define my en to fallback to Quasar’s en-gb file in the absence of en? Or should I do something else? Renaming quasar/lang/en-gb.js to en.js is a workaround, but obviously it will be obliterated on the next quasar update, so this is not a good solution.

      1 Reply Last reply Reply Quote 0
      • PeterQF
        PeterQF last edited by PeterQF

        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
          }
        }
        
        1 Reply Last reply Reply Quote 0
        • ssuess
          ssuess last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • ssuess
            ssuess last edited by

            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”.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post