-
Notifications
You must be signed in to change notification settings - Fork 1.9k
iOS/Mac Catalyst image localization #16734
Copy link
Copy link
Closed
Labels
area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, ResizetizerSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizerfixed-in-8.0.70fixed-in-9.0.0-preview.7.24407.4i/great-reporterThis issue is opened by an author who is known to open high-quality issuesThis issue is opened by an author who is known to open high-quality issuesplatform/iosplatform/macosmacOS / Mac CatalystmacOS / Mac Catalysts/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Metadata
Metadata
Assignees
Labels
area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, ResizetizerSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizerfixed-in-8.0.70fixed-in-9.0.0-preview.7.24407.4i/great-reporterThis issue is opened by an author who is known to open high-quality issuesThis issue is opened by an author who is known to open high-quality issuesplatform/iosplatform/macosmacOS / Mac CatalystmacOS / Mac Catalysts/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
The technique for localizing images on iOS are well known. It involves creating folders with the locale name, followed by .lproj, with the images in these folders. These would normally go in a Resources folder. So for MAUI I translated this to the Platforms\iOS\Resources folder:
The images have a build action of BundleResource.
This doesn't work for iOS, or on Mac Catalyst (using the equivalent MacCatalyst folder).
What does work is putting the .lproj folders in the root of the MAUI project:
Localized images are then displayed (on both iOS + MacCat).
While it works it makes me feel dirty having the root of your project contaminated with Apple only resources.
UPDATE: @rolfbjarne has told me that updating the .csproj to include
<IPhoneResourcePrefix>Platforms/iOS/Resources</IPhoneResourcePrefix>makes localised images, contained in that specific folder, work on iOS + MacCat.Steps to Reproduce
Link to public reproduction project repository
https://github.com/davidbritch/dotnet-maui-issues/tree/main/LocalizationDemo
Version with bug
7.0.92
Is this a regression from previous behavior?
Don't think this has ever worked!
Affected platforms
iOS, macOS
Did you find any workaround?
Place .lproj folders in the root of your MAUI project.
OR (better)
Update your .csproj with the following: