Re: Overriding default language in single MUI resource file
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Mon, 02 Apr 2007 12:32:42 -0400
It would be more typical to override this with a Registry entry. I believe that doing a
SetThreadLocale will solve the problem. I've not done this, but I believe this is what is
required. Simple test: Do a SetThreadLocale of the appropriate value in your
InitInstance handler. If it works, set it up to read the value from the Registry.
If you use a .INI file (not a good idea), they you must not store it in the directory of
the executable image; use ::SHGetFolderPath(CSIDL_APPDATA) to get the directory on which
you should store it. This makes it per-user, and in many sites (and under Vista) the
executable directory will be protected.
I see no reason to bind the decision at install time, although you don't necessarily need
to bind on-the-fly (require a restart to get the new language). You might consider
settingup an HKLM key at install time and all an HKCU key. If the HKCU key is not
present, go read the HKLM key. This would give maximum flexibility and would not require
a reinstall to change the language.
joe
On Mon, 2 Apr 2007 11:36:42 -0400, "gary" <gwa000@xxxxxxxxxxxxxxxxx> wrote:
we have an application where we have all of the resources for all of theJoseph M. Newcomer [MVP]
languages in a single resource file. we use this resource file via the
standard MFC AfxSetResourceHandle. my understanding is that if we have
English and German in this one resource file than on an English system the
English strings will be displayed. on a German system the German strings
will be displayed.
my question is, is it possible to override this functionality, say with an
INI file, so that on a German system the English resources are displayed.
this would not be dynamic in nature in that a user can change the localized
strings on-the-fly. rather it would be done at install time. this approach
would allow us to use one resource file and let the system pick the correct
strings. however, if the user wanted the language to be different than the
default they could install the program for the non-standard language (using
the SAME resource file) and we would put this desired language in the INI
file.
i know that we could have one resource file for each language and that is
what we had initially. however we are going to be supporting a ton of
languages and we thought the single resource file approach would be simpler
(e.g. less resource language projects in the VC++ solution).
thanks!
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Prev by Date: Re: Visual C++ Book
- Next by Date: Re: Where are my events going...
- Previous by thread: monitoring the que
- Next by thread: Re: Overriding default language in single MUI resource file
- Index(es):
Relevant Pages
|