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. Localitzation of transtation files and name of locales.
Forum Updated to NodeBB v4.3 + New Features

Localitzation of transtation files and name of locales.

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.1k Views 1 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.
  • J Offline
    J Offline
    jduran
    wrote on last edited by
    #1

    Dear all,

    I'm developing an application with some translations files. These translation files could be installed automatically by .pro file. However in the application, to load a translation file, QTranstalor needs the directory where the translation files are located. From the application point of view, at runtime how can It to now where the translations files are located? Perhaps a variable from qmake should be passed to the application?

    The name of the translation files should include the name of the locale. In Qt5.3, the name of translations only includes the name of the language but not the country (qt_ca.qm), however when I define a locale for a language, the name of the locale is 'language_COUNTRY' (qt_ca_ES.qm). Which is the right format of the translation file name?

    Thanks and Best Regards,
    Joaquim Duran

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Did you check QCoreApplication::applicationDirPath(..) or applicationFilePath(..) etc ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jduran
        wrote on last edited by
        #3

        Yes, but these function member only return the path to the executable file and it is not what I'm looking for.

        I'm looking for something like QLibraryInfo::location(QLibraryInfo::TranslationsPath) but referred to the application.

        Joaquim Duran

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Where are you placing translation files ? You can put your application translation files in your application directory path while installing your app. This way you can load from your path only.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jduran
            wrote on last edited by
            #5

            By default, they are installed in /usr/local/shared/application/translations, but if I change set PREFIX=/usr in qmake, it could be /usr/shared/application/translations.

            Anyway, I don't expect install the translations files in $$PREFIX/bin.

            1 Reply Last reply
            0

            • Login

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