Reputation: 4267
I have a UWP application with Resource Files (.resx) for translation in a .net standard 2.0 library. When I add new strings there and try to resolve them I get "null" in return. All the existing strings are available and resolved correctly. Here is an example:
When I follow the reference, I see that there is actually an entry in the designer:
Also I can see it in the xml of the resource file:
What can be wrong here?
EDIT: Here is the Link to the project: https://github.com/MoneyFox/MoneyFox
EDIT2: I found out that the issue is with files for different languages. If I add the new string in all my language files the string is resolved properly. So it seems that the fallback does not work as it should.
Upvotes: 0
Views: 1508
Reputation: 427
Go to the AppResource.Designer.cs and change the methodenames down below. In my case they didn't update to the new names of the strings, so I couldn't pick them.
Upvotes: 2
Reputation: 4267
After some further investigation I figured out that the issue is that there was no default language set for the .net library. After I added this to the .csproj resolving worked again:
<PropertyGroup>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>
Not that I had the default language set in the package reference, but as it seems that is not / no longer enough in that case.
Upvotes: 1
Reputation: 1489
It could be because your Code Generated by the "ResXFileCodeGenerator" have not updated the Code for your newly added strings.
To refresh the code that was auto generated, try Right Click on the Resx -> Run Custom Tool, Rebuild the Application and Run.
Before all the steps , make sure that the resx is having the right autogenerated .cs file mapped in the .proj file and the "ResXFileCodeGenerator" is selected in the "Custom Tool" in the properties.
Upvotes: 2