locked
Missing Something Basic: MUI Fallback from fr-fr to fr to en? RRS feed

  • Question

  • I have a very simple native Visual C++ program that has mui support.  When I deploy it on a fr-fr system, it shows the fr-fr mui resources.  But when I deploy it on a fr-ca system, I'd like it to show the fr resources ... but it goes straight to the ultimate fallback language (in my case, en-us).

    I think I must be missing something basic.  I have created "fr" resources and placed the corresponding .mui file in a fr subdirectory.  But while anything with a complete locale can work (en-us, fr-fr, etc.), having a more neutral version (e.g., fr or es) simply never gets used.

    From the docs, I would have thought that Windows would first look for the exact locale, then go for the next level up (e.g., fr), then go for the ultimate fallback.  What happens is that either I get an exact locale match, or it goes straight to the ultimate fallback.

    Even making an explicit call to SetThreadPreferredUILanguages cannot make "fr" work.  A call to to GetThreadPreferredUILanguages does indeed show "fr" in the list.  Calling GetFileMUIPath iterates through all supported languages, and indeed, fr shows up.  But it cannot be called!

    Please enlighten me.  How am I supposed to set up this hierarchical fallback? There's something different about these intermediate language (locale-neutral) versions.  I can get it to work for just "vi", so it's not a "two-letter" issue, but that's likely because there are not any Vietnamese locales.  Should there actually be a subdirectory just called "fr"?  If not, how does this work?

    Sunday, July 28, 2013 2:41 AM

Answers

  • After much painful experimentation, I have come to the conclusion that although Windows will happily accept and report on so-called neutral languages (e.g., "fr"), it does not actually look for them in that way.  

    If the system is running "fr-ca" but one's program only has available "fr-fr", Windows will do the smart thing and use "fr-fr".  But if all it has is a "fr" folder, Windows will not use it.  If one explicitly requests "fr" in SetThreadPreferredUILanguages, it will happily accept it, and happily report it back from GetThreadPreferredUILanguages.  It will happily list "fr" as available from GetFileMUIPath. But it will not do anything productive with it, not even look for "fr-fr".

    Simple answer: do not attempt to use "fr" or "es" or any other "language neutral" nomenclature.  You must always fully specify the locale, and by unspoken agreement, things like "fr-fr" are considered neutral. 
    • Marked as answer by Dev931 Sunday, July 28, 2013 3:19 PM
    Sunday, July 28, 2013 3:18 PM