Hi,
as far as I understood, if I want to change the culture to use in order to retrieve the localized string I have to use the WithCulture extension method in this way (I've used the Askmethat.Aspnet.JsonLocalizer.Sample.I18nTest example):
Looking the code the implementation of GetString, it is correctly based on CultureInfo.CurrentUICulture but the WithCulture is working on CultureInfo.CurrentCulture:
public IStringLocalizer WithCulture(CultureInfo culture)
{
if (!_localizationOptions.Value.SupportedCultureInfos.Contains(culture))
{
_localizationOptions.Value.SupportedCultureInfos.Add(culture);
}
CultureInfo.CurrentCulture = culture;
return new JsonStringLocalizer(_localizationOptions, _env);
}
Am I wrong or the WithCulture is buggy?
In case of no, what's the correct way to retrieve a localized string on a specific culture that is different from the current?
Hi, as far as I understood, if I want to change the culture to use in order to retrieve the localized string I have to use the
WithCulture
extension method in this way (I've used the Askmethat.Aspnet.JsonLocalizer.Sample.I18nTest example):Unfortunately this method is always return the request culture or default instead of fr-FR that is supported:
Looking the code the implementation of
GetString
, it is correctly based onCultureInfo.CurrentUICulture
but theWithCulture
is working onCultureInfo.CurrentCulture
:Am I wrong or the WithCulture is buggy? In case of no, what's the correct way to retrieve a localized string on a specific culture that is different from the current?
Thanks