banditoth / MAUI.Packages

A toolkit for .NET MAUI 🏝, containing useful stuff to ease development for MAUI applications.
MIT License
39 stars 1 forks source link

config.UseResource() not finding the .resx file #1

Closed pramosfsgroup closed 1 year ago

pramosfsgroup commented 1 year ago

The initialization of the multilanguage fails. The name Translations does not exist image when i have the Translations.resx defined like this: image

banditoth commented 1 year ago

Hey @pramosfsgroup . Sorry for the late response. Seems like from the icon on the Translations.resx that the IDE is not building a designer.cs file out of the resource file. Make sure you set the ResXFileGenerator runs when you save the resource. Right click on the file and under the properties tab, you can set it to work.

Or if you are using VS for Mac you can achieve it by the following snippet in the csproj file

<EmbeddedResource Update="Resources\Translations\Translations.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>MSMobileTranslations.Designer.cs</LastGenOutput>
    </EmbeddedResource>

After you see an arrow pointing down next to your file in the solution explorer, expand it, and you will see the generated designer.cs file under your resx file.

Then dont forget to add the using statement in the Startup.cs:)

Hope this helps.

banditoth commented 1 year ago

Closing due to lack of activity on this issue.