Re: Overriding default language in single MUI resource file

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



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
    ... the reason why we are using an INI file is due to the vendor toolkit being ... the toolkit is for a driver and the INI file is actually part of the ... to bind on-the-fly (require a restart to get the new language). ... languages in a single resource file. ...
    (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)
  • Re: Translating using resource files
    ... I have repor file written in one language. ... resource file, the key would be 'dog' and the returned value would be ... Major issue is that it is not possible to use keys to design reports. ... Reports contain strings in certain language. ...
    (microsoft.public.dotnet.languages.csharp)
  • 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)