'Localisation resx not being picked up in .NET MAUI
I've started moving my native app into MAUI but are having issues with getting the translated resx values to get picked up. Note! The default resx-translation values are used, so it's just the localized resx that isn't working.
- I've added two resx-files, AppRes.resx and AppRes.sv.resx
- I've set the applicable languages in
<key>CFBundleLocalizations</key>in the info.plist file (on both ios and maccatalyst) - I've added the Microsoft.Extensions.Localization nuget package
- I've added
builder.Services.AddLocalization();to the MauiProgram file - I'm assigning the value in the xaml-file as
<Label Text="{x:Static res:AppRes.Account_SignInLabel} ...
What am I missing? As stated above, I can see that the default AppRes.resx file is being used as changes to the value is displayed in my page, but it won't pick up the Swedish translation. Tried on both ios simulator and maccatalyst simulator (yes, the sim is displaying Swedish).
Side note! Not sure this is relevant but string lang = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; on the page in question will return null, where I perhaps expected "sv"?!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
