Multilanguages resource file (one file)
-
Hello, I want to display automatically my application in OS language. I do not want to use satellite DLL. I would like to have all resource strings in several string table in one resource file. Is it possible ? Thank you, Freg
Yes it is possible. BUT.. I am just able to talk about VC6 / no Unicode builds, because this is what we use here. We didn't had a problem with this so far.. It can be a little bit tricky with different codepages. But we never had to include Asian languages. No clue if you are going to have problems with those.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -- modified at 3:54 Thursday 9th February, 2006 -
Yes it is possible. BUT.. I am just able to talk about VC6 / no Unicode builds, because this is what we use here. We didn't had a problem with this so far.. It can be a little bit tricky with different codepages. But we never had to include Asian languages. No clue if you are going to have problems with those.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -- modified at 3:54 Thursday 9th February, 2006so bernhard, your solution is...?
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...] -
so bernhard, your solution is...?
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...]as he said.. insert the string table in the resource file. Translate the strings. There are some programs out there which aid you in translating those files. But in general this is it. I think the asked "Is it possible to do this?" And I said: "Yes you can, as long as you don't use languages which need more than 1 byte per character"
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -
as he said.. insert the string table in the resource file. Translate the strings. There are some programs out there which aid you in translating those files. But in general this is it. I think the asked "Is it possible to do this?" And I said: "Yes you can, as long as you don't use languages which need more than 1 byte per character"
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xxyeah ok... i just understood more than he asked... i thought he was asking for "how to do this...". ;) but tell me, ,as you already do it like this, could you explain a brief piece of code (considering we already have several resource string tables, and we already know how to load/display the needed strings) on how we can switch from one language to one other ?
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...] -
yeah ok... i just understood more than he asked... i thought he was asking for "how to do this...". ;) but tell me, ,as you already do it like this, could you explain a brief piece of code (considering we already have several resource string tables, and we already know how to load/display the needed strings) on how we can switch from one language to one other ?
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...]Normally it takes the system preference's language. So you shouldn't need to worry about this. But you can change the behavior by hand when calling: SetThreadLocale(MAKELCID(LANG_ENGLISH,SORT_DEFAULT)); This would force the program to use the English strings after the call. One small problem you are going to encounter (at least in our setup): If the strings are in a different codepage, you are not going to see the "real" strings out of this. But as soon as the computer is set up to correct codepage, you see the strings correctly. If you'd use a unicode app, this problem should be solved (at least as much as I know.. never had the chance to try it).
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -
Normally it takes the system preference's language. So you shouldn't need to worry about this. But you can change the behavior by hand when calling: SetThreadLocale(MAKELCID(LANG_ENGLISH,SORT_DEFAULT)); This would force the program to use the English strings after the call. One small problem you are going to encounter (at least in our setup): If the strings are in a different codepage, you are not going to see the "real" strings out of this. But as soon as the computer is set up to correct codepage, you see the strings correctly. If you'd use a unicode app, this problem should be solved (at least as much as I know.. never had the chance to try it).
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx -
Normally it takes the system preference's language. So you shouldn't need to worry about this. But you can change the behavior by hand when calling: SetThreadLocale(MAKELCID(LANG_ENGLISH,SORT_DEFAULT)); This would force the program to use the English strings after the call. One small problem you are going to encounter (at least in our setup): If the strings are in a different codepage, you are not going to see the "real" strings out of this. But as soon as the computer is set up to correct codepage, you see the strings correctly. If you'd use a unicode app, this problem should be solved (at least as much as I know.. never had the chance to try it).
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xxone last question : where to call
SetThreadLocale()
? anywhere afterOnInitDialog()
? what are this macros (how are they defined) ? :MAKELCID()
,LANG_ENGLISH
,SORT_DEFAULT
. thanks for the prompt and concise answer... :rose: ps: i don't have any visual studio installed, and am quite bored about msdn today, so here is why i ask all this to someone who seems to wqell know the subject...
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...] -- modified at 4:19 Thursday 9th February, 2006 -
one last question : where to call
SetThreadLocale()
? anywhere afterOnInitDialog()
? what are this macros (how are they defined) ? :MAKELCID()
,LANG_ENGLISH
,SORT_DEFAULT
. thanks for the prompt and concise answer... :rose: ps: i don't have any visual studio installed, and am quite bored about msdn today, so here is why i ask all this to someone who seems to wqell know the subject...
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...] -- modified at 4:19 Thursday 9th February, 2006We are calling it the InitInstance of the application. Then all the dialogs / views are set up with the correct strings. If you want to change the language at runtime, you have to call this language first and then "refresh" all your views / menus whatever. (Set the item texts with the new strings from the resource table) (But this whole process depends on the structure of the program) More information on SetThreadLocal http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls\_52lh.asp Regarding your exact question: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls\_7qck.asp
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects."
Roger Wright
http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx