Re: Overriding default language in single MUI resource file
- From: "gary" <gwa000@xxxxxxxxxxxxxxxxx>
- Date: Mon, 2 Apr 2007 15:45:39 -0400
the reason why we are using an INI file is due to the vendor toolkit being
used. the toolkit is for a driver and the INI file is actually part of the
driver
component. the vendor makes use of it for language support in case you
want to override the default MUI "all resources in 1 DLL" for the given
system
and use a different langauge.
the component that the driver uses works using this approach. we have a few
MFC applications we wrote and just wanted to use the same architecture.
i'll give SetThreadLocale a try. an article on CodeProject also mentions
that you also need to due a setlocale so that CRT library functions behave
properly (e.g. formatting numbers, etc.).
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:kab213hut3hquceb1k2142153tku07qob5@xxxxxxxxxx
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
.
- References:
- Re: Overriding default language in single MUI resource file
- From: Joseph M . Newcomer
- Re: Overriding default language in single MUI resource file
- Prev by Date: Re: Your advice about WorkerThreads vs UI Threads
- Next by Date: Re: Adding controls to SDI and MDI programs
- Previous by thread: Re: Overriding default language in single MUI resource file
- Next by thread: MFC + OpengGL + Multithreading
- Index(es):
Relevant Pages
|