Skip to content

Handle Multi Lang Strings in XAML base C++ WinRT Unpackaged application #10393

@mdnchauhan

Description

@mdnchauhan

Describe the bug

My application is - WinUI3 XAML based C++WinRT, Unpackaged App
for handling MultiLanguages strings, I am implementing .resw files.
[Microsoft.Windows.CppWinRT version 2.0.240405.15]

There are two resw files

Englishtext
Strings/en-US/Resources.resw

Polish text
Strings\pl-PL\Resources.resw

Problem :- I get the text of the Lang which is set as Preferred Lang in settings.
If it is a Polish machine and user has changed the "Preferred Languages" to English instead of Polish. (Settings -> Time&Language -> Lang & Region -> Preferred Languages ), then it picks English string NOT the Polish one.

Is there any way to set the Language as per our need in c++ WinRT app in such a way that my app will pick Polish text only... irrespective of what is set as Default Preferred lang.

I tried to set DefaultLang by using winrt::Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride but it throws exception message "The process has no package identity".

Thanks,
MChauhan

Steps to reproduce the bug

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-C++/WinRTIssues related with C++/WinRT experiencebugSomething isn't workinggroup-language

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions