Open DominikErnst opened 11 months ago
As a workaround, you can add the translation resources to a separate assembly (e.g. a netstandard2.0 library). Later, when MAT is capable of handling net8.0-android and net8.0-ios projects, you can always move the resx and xlf files back to the MAUI project.
Have a look at this sample project: https://github.com/hsrcasnet/MauiSamples/tree/main/LocalizationDemo
I was able to get the MAT plugin to work with a MAUI project (MAUI Blazor in my case).
1) Create your base language .resx
file. e.g. MyApp.resx
2) Add the following to the .csproj
project file.
<PropertyGroup Label="MultilingualAppToolkit">
<MultilingualAppToolkitVersion>4.0</MultilingualAppToolkitVersion>
<MultilingualFallbackLanguage>en-US</MultilingualFallbackLanguage>
<TranslationReport Condition="'$(Configuration)' == 'Release'">true</TranslationReport>
<SuppressPseudoWarning Condition="'$(Configuration)' == 'Debug'">true</SuppressPseudoWarning>
<Nullable>enable</Nullable>
</PropertyGroup>
and
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.ResxResources.targets" Label="MultilingualAppToolkit" Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\v$(MultilingualAppToolkitVersion)\Microsoft.Multilingual.ResxResources.targets')" />
<Target Name="MATPrerequisite" BeforeTargets="PrepareForBuild" Condition="!Exists('$(MSBuildExtensionsPath)\Microsoft\Multilingual App Toolkit\Microsoft.Multilingual.ResxResources.targets')" Label="MultilingualAppToolkit">
<Warning Text="$(MSBuildProjectFile) is Multilingual build enabled, but the Multilingual App Toolkit is unavailable during the build. If building with Visual Studio, please check to ensure that toolkit is properly installed." />
</Target>
3) Restart visual studio. This is key.
After the restart, the plugin will have the option to add translation languages from the MAT plugin by right clicking the project.
Hello. Great that it works for you. Unfortunately not for me. :-( I think that Project is dead.
I have the impression that Microsoft is phasing out its support for developers. This can also be seen in the very, very poor MAUI product. In the future, everything will be done by AI. Developers are apparently already superfluous.
Hi @DominikErnst,
Could you provide a sample (via a GitHub repository) that repro's this issue? That would be very helpful in investigating.
@joshftb your workaround works perfectly. I could get rid of my separate assembly trick.
@DominikErnst: Have a look at this sample app. This is a very minimal app for demo purposes which works with MAT and .NET MAUI 8.
@thomasgalliker ok, thank you. Interesting. Didn't work on my machine?!? I have meetings all day, will get back to you later.
@thomasgalliker ooohhhhhhh nooooo, it works better with admin rights, but I think not 100%!!! :-) I'll test later!
Since it wasn't working anymore I wrote a new tool for this, if you are interested you can find it here:
Please add support for MAUI! Thank you