MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
227 stars 493 forks source link

CoreTextServicesManager.InputLanguage returns wrong language #2431

Open DJm00n opened 7 months ago

DJm00n commented 7 months ago

I have found that Windows.UI.Text.Core.CoreTextServicesManager.InputLanguage.LanguageTag may return wrong input language that is not the same as returned from Windows.Globalization.Language.CurrentInputMethodLanguageTag. It is wrong in case of some transient input languages (that doesn't have LCID).

It seems there is same issue as I have already reported with LCIDToLocaleName API. LCIDToLocaleName returns same wrong language tags when I tried to convert transient LCID to a language tag.

It could be easily reproduced like this:

 Windows::UI::Text::Core::CoreTextServicesManager::GetForCurrentView()->InputLanguageChanged +=
        ref new TypedEventHandler<Windows::UI::Text::Core::CoreTextServicesManager ^, Platform::Object ^>(this, &SDL_WinRTApp::OnLanguageChanged);

....

void SDL_WinRTApp::OnLanguageChanged(Windows::UI::Text::Core::CoreTextServicesManager ^ sender, Platform::Object ^ args)
{
    Windows::Globalization::Language ^ language = sender->InputLanguage;
    Windows::Globalization::Language ^ language2 = ref new Windows::Globalization::Language(Windows::Globalization::Language::CurrentInputMethodLanguageTag);
}
image image image

What Get-WinUserLanguageList PowerShell cmdlet returns:

image

Also reported here: https://github.com/dotnet/runtime/issues/82367


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

DJm00n commented 7 months ago

@Karl-Bridge-Microsoft can you please take a look?

DJm00n commented 6 months ago

Hey @Karl-Bridge-Microsoft! Do you have any updates on this topic?

DJm00n commented 1 month ago

@Karl-Bridge-Microsoft any updates?