In my .NET MAUI App I use AppResources.de.resx and AppResources.resx
I can access resource constants in Code-Behind via AppResources.CancelButtonText
.
Unfortunately, some of the constants are not accessible via AppResources and do not show up and raise an Error when used:
'AppResources' does not contain a definition for 'ManageItem_DeleteMessage_UsedInSavedItems'
I don't get why, since these constants are definitively available and I copied and pasted the string. They don't show up in IntelliSense and don't compile successfully when used.
I still can access it as a string in LanguageResourceManager["..."].
Tried by clearing my caches, too. Did not help.
=== Update of my Resource Files ===
There is a default AppResources.resx - both have the same set of constants
=== Update after generating a new AppResources.resx file ===
Seems like the naming now is totally screwed, but seems to be working anyway:
I added a new AppResources.resx file (with an 's'). But the Designer File is without 's':
The section in my .csproj looks like this:
The image show that the default resource file and the designer file is not associated. When a default resuource file is created it automatic creates a associated extention file called Designer.cs
. It helps accessing the resources by key.
If you copy resource files from another project this could typical happened.
The easiest way is to create new one and copy the fields from the original.
Read more about Localization files and how they work here