Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get a string's translation with the context ignored?
Forum Updated to NodeBB v4.3 + New Features

How to get a string's translation with the context ignored?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 406 Views 3 Watching
  • 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    I'd like to translate a string while ignoring the context of it, but QCoreApplication::translate("", sourceText.toUtf8().constData()) isn't cutting it. Any ideas on what would work?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      You mean like

      QString FriendlyConversation::greeting(int type)
      {
          static const char *greeting_strings[] = {
              QT_TR_NOOP("Hello"),
              QT_TR_NOOP("Goodbye")
          };
          return tr(greeting_strings[type]);
      }
      

      http://doc.qt.io/qt-5/i18n-source-translation.html

      If they are stored with a context, im not sure its possible to ignore context on fetching as
      that would collapse the structure.

      1 Reply Last reply
      2
      • V Offline
        V Offline
        Vadi2
        wrote on last edited by
        #3

        Hm, okay. I'll try sand see if the mailing list has any ideas :)

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved