File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ windows-core = "0.61.0"
2626version = " 0.61.1"
2727features = [
2828 " Win32_Foundation" ,
29+ " Win32_Globalization" ,
2930 " Win32_Graphics_Gdi" ,
3031 " Win32_System_Com" ,
3132 " Win32_System_LibraryLoader" ,
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ impl InnerWindowState {
9595 if self . announcement . is_some ( ) {
9696 node. push_child ( ANNOUNCEMENT_ID ) ;
9797 }
98+ node. set_language ( "en" ) ;
9899 node
99100 }
100101}
Original file line number Diff line number Diff line change @@ -276,6 +276,10 @@ impl NodeWrapper<'_> {
276276 self . 0 . description ( )
277277 }
278278
279+ fn culture ( & self ) -> Option < LocaleName < ' _ > > {
280+ self . 0 . language ( ) . map ( LocaleName )
281+ }
282+
279283 fn placeholder ( & self ) -> Option < & str > {
280284 self . 0 . placeholder ( )
281285 }
@@ -962,6 +966,7 @@ properties! {
962966 ( UIA_LocalizedControlTypePropertyId , localized_control_type) ,
963967 ( UIA_NamePropertyId , name) ,
964968 ( UIA_FullDescriptionPropertyId , description) ,
969+ ( UIA_CulturePropertyId , culture) ,
965970 ( UIA_HelpTextPropertyId , placeholder) ,
966971 ( UIA_IsContentElementPropertyId , is_content_element) ,
967972 ( UIA_IsControlElementPropertyId , is_content_element) ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ use windows::{
1414 core:: * ,
1515 Win32 :: {
1616 Foundation :: * ,
17+ Globalization :: * ,
1718 Graphics :: Gdi :: * ,
1819 System :: { Com :: * , Ole :: * , Variant :: * } ,
1920 UI :: { Accessibility :: * , WindowsAndMessaging :: * } ,
@@ -43,6 +44,16 @@ impl From<WideString> for BSTR {
4344 }
4445}
4546
47+ #[ derive( Debug , PartialEq , Eq ) ]
48+ pub ( crate ) struct LocaleName < ' a > ( pub ( crate ) & ' a str ) ;
49+
50+ impl From < LocaleName < ' _ > > for Variant {
51+ fn from ( value : LocaleName ) -> Self {
52+ let lcid = unsafe { LocaleNameToLCID ( & HSTRING :: from ( value. 0 ) , LOCALE_ALLOW_NEUTRAL_NAMES ) } ;
53+ ( lcid != 0 ) . then_some ( lcid as i32 ) . into ( )
54+ }
55+ }
56+
4657pub ( crate ) struct Variant ( VARIANT ) ;
4758
4859impl From < Variant > for VARIANT {
You can’t perform that action at this time.
0 commit comments