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

    i18n & Quasar: How to bind locale strings to q-item-main label?

    Help
    2
    4
    1968
    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.
    • arjanski
      arjanski last edited by arjanski

      Hello everyone,

      Quasar & Vue beginner here, this might be a general question, I’ve come across it as I am trying to dynamically bind translated strings to my q-list dropdown menu, respectively the q-item-main label property.

      So this static label “Labeltext”

             <q-item @click="launch('http://quasar-framework.org')">
                      <q-item-main label="Labeltext"/>
              </q-item>
      

      I’d like to replace “Labeltext” with a i18n string that would usually be set up like this (it’s a pluralization):
      {{ $tc(‘menu.menu_2’, 0) }}

      So using this in a <p> tag or anywhere outside a property works fine. I am just not sure how using it in a property.

      I am sure this can be done, hope that someone has an idea.

      Thank you very much in advance and happy coding

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

         <q-item @click="launch('http://quasar-framework.org')">
                        <q-item-main :label="$tc(‘menu.menu_2’, 0)"/>
                </q-item>
        

        Note the : this binds the prop to a function instead of using the string.

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

          Thank you once again @a47ae !

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

            Always glad when I can help! 🙂

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