uno/tools/ResourcesExtractor
Simon Cropp 6de0804f92 chore: make csproj indents match editor config 2024-02-03 11:47:37 +11:00
..
ResourcesExtractor chore: make csproj indents match editor config 2024-02-03 11:47:37 +11:00
README.md
ResourcesExtractor.sln

README.md

ResourcesExtractor

This tool helps generating localized resources from a running WinUI application given the localizedResource.h file from WinUI source code.

The language codes were extracted based on winrt.h. The following method can be used to get a language id:

private static int MAKELANGID(int primaryLang, int subLang)
{
   return ((((ushort)(subLang)) << 10) | (ushort)(primaryLang));
}

For example, let's look into winrt.h for en-US. The two relevant entries are:

#define LANG_ENGLISH                     0x09
#define SUBLANG_ENGLISH_US                          0x01    // English (USA)

So, now if you do Console.WriteLine(MAKELANGID(0x09, 0x01).ToString("X"));, you'll get 409, so it's en-US is defined in Languages enum as en_us = 0x409.

The result of this tool is added in src\Uno.UI\Microsoft\UI\Xaml\Controls\WinUIResources