Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ITranslationProvider.LoadTranslationsAsync() #15886

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix the build
  • Loading branch information
hishamco committed Apr 26, 2024
commit f8246fd2e1806fd2572a36b04bf36ec702d06b3b
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 41,7 @@ public override LocalizedHtmlString this[string name]
if (_localizer is IPluralStringLocalizer pluralLocalizer && arguments.Length == 1 && arguments[0] is PluralizationArgument)
{
// Get an unformatted string and all non plural arguments (1st one is the plural count).
var (translation, argumentsWithCount) = pluralLocalizer.GetTranslation(name, arguments);
var (translation, argumentsWithCount) = pluralLocalizer.GetTranslationAsync(name, arguments).GetAwaiter().GetResult();
hishamco marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

@sebastienros sebastienros Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this PR to come back to this pitfall, for every single invokation of the localizer. It was better before, even if it was not reading the file asynchronously once)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe because we didn't do it the right way from the beginning :)


// Formatting will use non plural arguments if any.
return ToHtmlString(translation, argumentsWithCount);
Expand Down