uno/tools/ResourcesExtractor
Martin Zikmund 5461f41d2c chore: Update tools 2024-09-13 11:26:51 +02:00
..
ResourcesExtractor chore: Update tools 2024-09-13 11:26:51 +02: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