uno/tools/ResourcesExtractor
Jerome Laban cccd4daa87 chore: Convert to WinUI 2023-12-20 20:39:40 -05:00
..
ResourcesExtractor chore: Convert to WinUI 2023-12-20 20:39:40 -05:00
README.md chore: Add link 2023-11-10 10:34:36 +02:00
ResourcesExtractor.sln feat: Add tool to generate WinUI localized resources 2023-11-09 20:04:05 +02:00

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