Windows - Locale detection


Hi folks!

I’ve just finished-off localizing the Wotja 2019 variants for iOS, macOS, Android and Windows; I’ve added Chinese and Japanese support. All variants have been approved by the various Stores, which is good news of course!

I’ve discovered that to get the Fonts working properly with a localised Juce app has required a lot of work.

Anyhow, I found an issue with Locale detection on Windows.

FYI, here is how I test for my support for different Locales, without needing to reboot my Windows installation. NB: it required a Juce patch.

  1. Go to Settings, then Region & Language;
    install languages you need
  2. install language pack (via Options) otherwise it won’t work :slight_smile:
  3. then, via options, set “Set as default”
  4. Run the app - it works (if you’ve coded your app properly)
  5. Remember to set back to your own language, or your Windows device will boot up in the selected language when you restart it!
// Required Juce patch: see also

String SystemStats::getDisplayLanguage()
    DynamicLibrary dll ("kernel32.dll");
    JUCE_LOAD_WINAPI_FUNCTION (dll, GetUserDefaultUILanguage, getUserDefaultUILanguage, LANGID, (void))

    if (getUserDefaultUILanguage == nullptr)
        return "en";

    // Here is the line I had to change, for Locale detection to work properly:
    //const DWORD langID = MAKELCID (getUserDefaultUILanguage(), SORT_DEFAULT);
    const DWORD langID = GetUserDefaultLCID();

Hoping this helps somebody,


Embedding unicode string literals in your cpp files