Re: Overriding default language in single MUI resource file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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 the
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!

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


.



Relevant Pages

  • Re: Overriding default language in single MUI resource file
    ... to bind on-the-fly (require a restart to get the new language). ... languages in a single resource file. ... English strings will be displayed. ... so that on a German system the English resources are displayed. ...
    (microsoft.public.vc.mfc)
  • Resource files / Language files
    ... In this resource file we had al labelcaptions, texts for messageboxes, ... so when the user chose for an interface in English all menu's etc.. ... In VB2005 though we would like to show the interface in the language of his ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to build the multi-language application?
    ... Some code then in a separate module to open the resource file and read it ... 'Application Language ... Public Function getRMValue(ByVal strValue As String) ... Dim strLanguage As String ...
    (microsoft.public.dotnet.languages.vb)
  • Assembly resource file not found for non-admin users!
    ... I have create some webpart controls to use in sharepoint. ... these webparts are in a DLL and I have a resource file for the french ... language resource file is not loaded. ... if an administrator load the page, then the DLL is found and loaded into the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Imagelist equivalent for text files
    ... You could add them to a database or resource file. ... method would be an ini file or flat file which lists the filepaths. ...
    (microsoft.public.vb.controls)