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 can my program have 2 languages?
Forum Updated to NodeBB v4.3 + New Features

How can my program have 2 languages?

Scheduled Pinned Locked Moved General and Desktop
26 Posts 8 Posters 11.4k 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.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #16

    [quote author="Leon" date="1309285305"]The translations at /usr/share/program/translations must be at .ts format or .qm format?[/quote]

    You need only qm files in runtime. ts files are used to translate. at runtime you want to load translated data.
    Also notice that there is no magic with /usr/share/program/translations. that was just a suggestion. you could put your translations in every other location...

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leon
      wrote on last edited by
      #17

      Ok thanks guys.. I am working on it..

      soroush i know it is a suggestion :P

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #18

        The .qm files can also be included as resources, too.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leon
          wrote on last edited by
          #19

          I am thinking of having english greek dutch and french language at my program.. Should i have a combobox with this 4 languages only ( using the resource file) or should i check for file existences at the path that i have my translations and then add them to the combobox?

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vsorokin
            wrote on last edited by
            #20

            Second way sounds better - this allow your users adding new languages for your app without re-compilation.
            of course if your public .ts file.

            --
            Vasiliy

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Leon
              wrote on last edited by
              #21

              Yes but who would do that? I think i will go with the first one and if anyone translate my app i will add the language at another version.. :)

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leon
                wrote on last edited by
                #22

                Hello again! What do you suggest? After the language has been changed ( at a combobox probably ) instantly everything change to the language you selected with "this way":http://developer.qt.nokia.com/faq/answer/how_can_i_dynamically_switch_between_languages_in_my_application_using_e.g_ or change the language after you restart the application?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  soroush
                  wrote on last edited by
                  #23

                  What I did was this:

                  1- Create a proxy subclass of QDialog named ProxyDialog wich have only one method: retranslateUI()
                  2- Subclass all dialogs from ProxyDialog
                  3- When you need to translate UI, just iterate over children of type ProxyDialog* and call retranslate UI for all of them. this is possible using findChildren function.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Leon
                    wrote on last edited by
                    #24

                    So you suggest that i should translate everything instantly?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      soroush
                      wrote on last edited by
                      #25

                      Yes. I'm not sure if there is a better way or not, but I looked around a lot and couldn't fount anything.
                      This works well for my applications.
                      You don't have to restart your application to see translation results. All open dialogs will be translated on-the-fly.

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        Leon
                        wrote on last edited by
                        #26

                        Ok then, thanks again!

                        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