Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the Locale Information Constants in Rust's winapi crate?

Tags:

rust

winapi

Are the Windows NLS API Locale Information Constants available anywhere in the winapi-rs crate or elsewhere in the Rust ecosystem?

I need to call GetLocaleInformationEx from Rust and have found it available in the um::winnls module of the winapi-rs crate (here).

The LCType input is a Locale Information Constant -- and I have not been able to find these defined anywhere in the crate.

As a workaround, I have looked up the numerical values and hard-coded them, but I have a nagging feeling that I am missing something.

like image 919
Janus Avatar asked Dec 03 '25 03:12

Janus


1 Answers

This is a late answer, but since other people can have this issue as well, so I'll still write my solution:

While the winapi crate doesn't contain all locale information constants, the windows-sys crate does.

On this Microsoft site there is a list of all available Locale information constants. These are also available as constants in windows_sys::Win32::Globalization, see here.

If you want to use winapi instead of windows-sys, I'd advice to just look up the value of the respective locale there and define your own constant in your Rust code.

like image 129
Korne127 Avatar answered Dec 05 '25 19:12

Korne127



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!