Toolbelt.Blazor.I18nText
Toolbelt.Blazor.I18nText copied to clipboard
Use I18nText from ClassLib
Greetings,
I try to use this package in the following setup:
Localization Class Library:
In this class lib the nuget package is installed, this also has the i18ntext folder with the json-files in it. Appart from that it has a class LocalizationBase that looks like this:
public class LocalizationBase : ComponentBase
{
[Inject] public Toolbelt.Blazor.I18nText.I18nText I18NText { get; set; } = default!;
public I18nText.MediaButler Translator { get; set; } = new();
protected override async Task OnInitializedAsync()
{
Translator = await I18NText.GetTextTableAsync<I18nText.MediaButler>(this);
}
}
BlazorWasm:
In this Blazor Wasm project I have a reference to the Localization class lib. My component inherits the LocalizationBase but when I try to translate UI elements with Translator.xxx I get the default text and in the browser dev console a 404 related to I18nText.
XHRGEThttps://localhost:5501/_content/i18ntext/Localization.I18nText.MediaButler.en-US.json?hash=b8n6o49rke
[HTTP/2 404 Not Found 0ms]
GET
https://localhost:5501/_content/i18ntext/Localization.I18nText.MediaButler.en-US.json?hash=b8n6o49rke
Status
404
Not Found
VersionHTTP/2
The Localization.I18nText.MediaButler.en-US.json is present in the _content/i18ntext folder in the build output.
The hash is the same as the one in the auto-generated Localization.I18nText.MediaButler.cs.
@MichaelHochriegl Thank you for letting me know!
I'll investigate this problem. However, I'm currently busy with other projects, so investigating and resolving this issue may take much longer than your expectation. I appreciate it if you are patient.
No worries and thanks for looking into it. If there is anything that I can do to help analyze the problem I 'm more than happy to help you.
@MichaelHochriegl Unfortunately, I could not reproduce your reported problem in my environment. I embedded my project file as a zip file on this post.
📦Issue53App-net6.0-i18n.v11.1.4.zip
Could you disclose your project that can reproduce your problem?
Did you try to modify file names? eg., Localization.I18nText.MediaButler.en-US.json -> Localization.I18nText.MediaButler.en.json