Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Translate a program or how can i make a program Translateble

How to Translate a program or how can i make a program Translateble

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
9 Posts 7 Posters 10 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.
  • W Offline
    W Offline
    whofmans
    wrote on last edited by
    #1

    Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

    W R C W A 6 Replies Last reply
    0
    • W whofmans

      Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

      W Offline
      W Offline
      wimel
      wrote on last edited by
      #2

      There are different way's to to that. The first one is to store every (yes, i mean every) label in a database. Before showing the label you must get it first from the database. It's very easy now to add a language. You only need to add a field for that language in the database. And a translater can fill in the new field. Your sourcecode remains the same. (no recompilations) The other way is to add every label to the stringtable of the resource. You need to recompile when you added a language. But you don't need a database. And the thirth way is the way I'll prefer for your project. Use a XML file with the labels for every language. It's not that hard to parse the XML-file. None of the techniques above are quick and easy to implement. You have to remove every label and get the label in the correct language succes ! W.

      1 Reply Last reply
      0
      • W whofmans

        Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

        R Offline
        R Offline
        Rage
        wrote on last edited by
        #3

        whofmans wrote: Is there a way to do this fast Nope. AFAIK, a lot has already been discussed about this thema. There is several articles about that in CP, try to make a search. ~RaGE();

        1 Reply Last reply
        0
        • W whofmans

          Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Another idea is to use a texte file of the following format: 01 "String1" 02 "String2" 03 "String3" .... and so on for every string you need to be translated. You create then a class that loads such a text file (you just have to specify the filename of the file to be loaded) and with a function that returns a string given an index (something like char* LanguageClass->GetString(int StringIndex) ). So, for every string in your project, (for example MessageBox("String1") ), you specify instead: MessageBox(LanguageClass->GetString(1) ). For the controls (for the static textes, you must change the Id to a specific value), you use the SetWindowText function to change the text. So, when you want to use another language you just have to specify another text file to be loaded. For example if you want to specify the language with the command line parameters, you construct your LanguageClass there and you specify wich language file has to be loaded. Hope this helps !

          1 Reply Last reply
          0
          • W whofmans

            Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

            W Offline
            W Offline
            whofmans
            wrote on last edited by
            #5

            Thank you all! I think i use the cmoonen's way. Only not with a Index integer but with the original string. The textfile looks then like this: "Hello" "Hallo" "Error" "Fout" If the string is not found in the textfile then i return the given string, otherwise the translated string will be returned.

            E T 2 Replies Last reply
            0
            • W whofmans

              Thank you all! I think i use the cmoonen's way. Only not with a Index integer but with the original string. The textfile looks then like this: "Hello" "Hallo" "Error" "Fout" If the string is not found in the textfile then i return the given string, otherwise the translated string will be returned.

              E Offline
              E Offline
              espelly
              wrote on last edited by
              #6

              sometimes a word may have two (or more) translations ("Commercial" in french may be a "sales Person" or "Commercial" in english). In this case you will have some problem with your method (you can only have one translation for one word). have a nice day

              1 Reply Last reply
              0
              • W whofmans

                Thank you all! I think i use the cmoonen's way. Only not with a Index integer but with the original string. The textfile looks then like this: "Hello" "Hallo" "Error" "Fout" If the string is not found in the textfile then i return the given string, otherwise the translated string will be returned.

                T Offline
                T Offline
                Ted Ferenc
                wrote on last edited by
                #7

                The main problem with this method, is the user can modify the text file, if someone changes a text string such as:- "Press Yes to delete all file" to Press Yes to leave all files" you tend to get some very irate phone calls! Although the good point is that a user can do their own translarions.


                If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

                1 Reply Last reply
                0
                • W whofmans

                  Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

                  A Offline
                  A Offline
                  Abbas_Riazi
                  wrote on last edited by
                  #8

                  The best solution is using Satellite DLL! A. Riazi

                  1 Reply Last reply
                  0
                  • W whofmans

                    Hi, I have programmed a program with Dialogs, menu's, messageboxes, etc. Now it must be translated to different language's. Is there a way to do this fast? It should be great if everybody can translate the program without the sourcecode thus with a textfile or something. Please give some ideas. Thanks, Willem

                    A Offline
                    A Offline
                    Abbas_Riazi
                    wrote on last edited by
                    #9

                    The best solution is using Satellite DLL. A. Riazi

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups