From b2386f00b98f0af1220cbd72b16763bbe61c7be4 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 29 Oct 2025 10:04:22 +0100 Subject: [PATCH 25/48] use the precise native language id that matched --- src/osx/core/uilocale.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osx/core/uilocale.mm b/src/osx/core/uilocale.mm index 796a7ce4e4..0d1700c06f 100644 --- a/src/osx/core/uilocale.mm +++ b/src/osx/core/uilocale.mm @@ -103,6 +103,8 @@ explicit wxUILocaleImplCF(NSLocale* nsloc) // completely invalid strings, so we need to check if the name is // actually in the list of the supported locales ourselves. bool isAvailable = false; + NSString* availableLocaleId = NULL; + wxOBJC_FOR_LOOP( id nsLocId, [NSLocale availableLocaleIdentifiers] ) { // We can't simply compare the names here because the list returned @@ -144,15 +146,17 @@ explicit wxUILocaleImplCF(NSLocale* nsloc) } } if ( isAvailable ) + { + availableLocaleId = nsLocId; break; + } } wxOBJC_END_FOR_LOOP if ( !isAvailable ) return nullptr; - wxCFStringRef cfName(locId.GetName()); - auto nsloc = [NSLocale localeWithLocaleIdentifier: cfName.AsNSString()]; + auto nsloc = [NSLocale localeWithLocaleIdentifier: availableLocaleId]; if ( !nsloc ) return nullptr; -- 2.24.3 (Apple Git-128)