I'm working on a Xamarin Forms app, using a .NET Standard library. I've used the TranslateExtension
as mentioned in the docs. I've added three resource files:
AppResources.resx
(with matching code-behind file, auto-generated)AppResources.nl.resx
(Dutch translations)AppResources.fr.resx
(English tranlations)
When debugging the (UWP) app, I can't get the default culture (English) to be displayed. The following line returns null:
ResMgr.Value.GetString(Text, ci);
I've add some lines for debugging, and the other two languages do return the translated value:
ResMgr.Value.GetString(Text, new CultureInfo("nl")); // OK
ResMgr.Value.GetString(Text, new CultureInfo("fr")); // OK
ResMgr.Value.GetString(Text, new CultureInfo("en")); // returns null
What could possibly be the cause of this?
Things I've tried:
- I've copy-pasted the key across all resource files, so I've ruled out misspelling the resource key.
- I've tested
"en-GB"
,"en-US"
,CultureInfo.InvariantCulture
. - I've changed the default lanuage in the appxmanifest from
en-US
toen
.