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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. string tables & language switch

string tables & language switch

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++com
8 Posts 5 Posters 0 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.
  • T Offline
    T Offline
    toxcct
    wrote on last edited by
    #1

    hi CPians, toxcct again. another wish i had for my prog was to have the possibility to switch all the text between French & English. I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names). Questions : 1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ? 2. how can i switch from one language to the other and vice versa ? 3. Is there a better/simplest way to do this far away from what i am doing now ?


    TOXCCT >>> GEII power
    [VisualCalc]

    J V F PJ ArendsP 4 Replies Last reply
    0
    • T toxcct

      hi CPians, toxcct again. another wish i had for my prog was to have the possibility to switch all the text between French & English. I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names). Questions : 1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ? 2. how can i switch from one language to the other and vice versa ? 3. Is there a better/simplest way to do this far away from what i am doing now ?


      TOXCCT >>> GEII power
      [VisualCalc]

      J Offline
      J Offline
      Jack Puppy
      wrote on last edited by
      #2

      Can't say whether it's the best way of doing it, but I use resource-only dlls. How To Create Localized Resource DLLs for MFC Application You should also search for "satellite dlls" at MSDN, I think there's an example project.

      :cool: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!

      1 Reply Last reply
      0
      • T toxcct

        hi CPians, toxcct again. another wish i had for my prog was to have the possibility to switch all the text between French & English. I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names). Questions : 1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ? 2. how can i switch from one language to the other and vice versa ? 3. Is there a better/simplest way to do this far away from what i am doing now ?


        TOXCCT >>> GEII power
        [VisualCalc]

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        In our app we have support for 3 languages (quite a drag and a lot of overhead) We give the same names in the string tables for all three languages. (make 1, copy it and change the text) When we change the language setting of windows our app switches too. Good luck. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

        T 1 Reply Last reply
        0
        • V V 0

          In our app we have support for 3 languages (quite a drag and a lot of overhead) We give the same names in the string tables for all three languages. (make 1, copy it and change the text) When we change the language setting of windows our app switches too. Good luck. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          ok but, how to change the language while the application is running ? i have a combobox with 2 entries ("Français" & "English"), and i would like (when a selection change is detected) to alter all the strings from one table to the other associated with the selected language.


          TOXCCT >>> GEII power
          [VisualCalc]

          V 1 Reply Last reply
          0
          • T toxcct

            ok but, how to change the language while the application is running ? i have a combobox with 2 entries ("Français" & "English"), and i would like (when a selection change is detected) to alter all the strings from one table to the other associated with the selected language.


            TOXCCT >>> GEII power
            [VisualCalc]

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            In that case I would think ahead. Load your captions dynamically with an xml document. This way you can add languages very easy in the future. You should then still find a solution on what to do when your app changes etc. So maybe not a good track either. I'm not sure it's so easy to what you want, maybe you can trigger the table-change, but I wouldn't know how :sigh:, sorry. good luck. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

            T 1 Reply Last reply
            0
            • V V 0

              In that case I would think ahead. Load your captions dynamically with an xml document. This way you can add languages very easy in the future. You should then still find a solution on what to do when your app changes etc. So maybe not a good track either. I'm not sure it's so easy to what you want, maybe you can trigger the table-change, but I wouldn't know how :sigh:, sorry. good luck. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              i cannot do this with string table ressource ?? strange if anybody knows... don't worry, tell me


              TOXCCT >>> GEII power
              [VisualCalc]

              1 Reply Last reply
              0
              • T toxcct

                hi CPians, toxcct again. another wish i had for my prog was to have the possibility to switch all the text between French & English. I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names). Questions : 1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ? 2. how can i switch from one language to the other and vice versa ? 3. Is there a better/simplest way to do this far away from what i am doing now ?


                TOXCCT >>> GEII power
                [VisualCalc]

                F Offline
                F Offline
                faroqtam
                wrote on last edited by
                #7

                Hi . u can create 2 Dll files with your resources and then use API function to load your resources as u wanted. On different Dll files u can use the same ID for the string. that is mean only change the dll file for specific language. for Example create Eng.dll file for English Version and Frn.dll for France Version. this make your program more esaer to development. Bye. On Earth nothing impossible, while your mind running. Faroqtam

                1 Reply Last reply
                0
                • T toxcct

                  hi CPians, toxcct again. another wish i had for my prog was to have the possibility to switch all the text between French & English. I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names). Questions : 1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ? 2. how can i switch from one language to the other and vice versa ? 3. Is there a better/simplest way to do this far away from what i am doing now ?


                  TOXCCT >>> GEII power
                  [VisualCalc]

                  PJ ArendsP Offline
                  PJ ArendsP Offline
                  PJ Arends
                  wrote on last edited by
                  #8

                  What I did to solve this problem was put all the strings in a *.ini file (you could also use a *.xml file as suggested by V). By using this method, other people can add as many translations as they want, without you having to recompile your app or any extraneous dlls.


                  "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

                  Within you lies the power for good; Use it!

                  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