Open monderino opened 1 year ago
@monderino You can define your common localized text tables in a Razor class library, and it can be used from any other Blazor projects with a project reference. I created a sample project and attached it.
📦Use same translations in multiple projects.zip
It that a helpful method for you?
Hi @jsakamoto,
yes, very nice.
Thank you very much.
Hi, I refactored my project but I end up in a problem, maybe you have an idea ;) So I created one razor library which contains my translation files and this library is added to different Blazor projects. Locally everything works quite well, but in my online system the translation do not show up. I build the project in a github action and I use a normal dotnet publish command. I realized, in the online system the translation files are missing in the /wwwroot/_content folder
Do you have any idea why this happen?
Thank you very much.
Best Sven
There is another issue, that the @types folder with the source generated files not appear. Not in the translation and blazor projects. Therefore I this to my project file to copy the generated files:
<!-- Store generated files in file system not only in memory -->
<PropertyGroup >
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
<!-- Run the item group only on debug not in release mode -->
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<!-- Include the output of source generated files in the compilation -->
<Compile Remove="Generated\**" />
</ItemGroup>
Maybe this is related to the issue above.
@monderino Thank you for your reporting. I wish I could investigate this problem immediately, but I can't right now because I'm a bit busy with another task. Please give me more time. Sorry for the inconvenience.
P.S.
that the
@types
folder with the source generated files not appear
The latest version of the I18n text library no longer need to generate any files in the @types
folder.
@jsakamoto alright, no problem.
Thank you very much for your help. If you need any further information, please let me know.
Best Sven
Hi,
I created a Blazer Server app with and used the i18nText. Everything works perfect. ;) Now I created a second app in my solution and I want to use the same translations here.
Is there a way to do that without creating everything twice?
Thanks and best regards Sven