Skip to content

Windows image localization papercut #16755

Open

Description

Description

In a .NET MAUI app you can follow the .NET Android approach to handling localized images and it works correctly. On iOS/MacCat you can follow the platform approach to handling localized images and it works with a workaround (see #16734).

Windows is equally mysterious. If you place your localized images, in locale folders, in the root of your MAUI project then image localization works:

MicrosoftTeams-image

This isn't great though. But placing them in Platform/Windows doesn't work:

MicrosoftTeams-image (1)

Similarly, placing them in Platform/Windows/Assets/Images doesn't work, which I'd hoped would work due to it being the UWP approach.

However, it's possible to make it work. Place your localized images in Platforms/Windows/Assets/Images (or whatever you want to call your images folder):

MicrosoftTeams-image

Those images will get copied to bin/.../win10-x64/AppX/Platforms/Windows/Assets/Images, which means to retrieve them in XAML you'll need to specify the path:

<Image Source="{OnPlatform flag.png, WinUI=Platforms/Windows/Assets/Images/flag.png}" />

So while this works I'd label it a papercut because the behaviour on one platform is different to the other platforms, where you don't have to worry about the path to the images.

Version with bug

7.0.92

Is this a regression from previous behavior?

No, this is something new

Affected platforms

Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-localizationLocalization and globalization issuesarea-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizeri/great-reporterThis issue is opened by an author who is known to open high-quality issuesplatform/windows 🪟s/needs-attentionIssue has more information and needs another looks/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions