-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fallback to the default culture resource #83
Comments
Do you mean this PR #41? |
Seems the PR is too old, I can confirm that culture fallback is working Lines 66 to 84 in 3dda94f
|
Yes. I mean PR #41. It seems that culture fallback isn't functioning correctly for the default culture. Typically, with the standard IStringLocalizer, if a string isn't found in I noticed in the previous PR that you implemented fallback to the default culture. Thank you for considering this. |
Please show me the localization setup in your code |
Here is the localization setup: builder.Services.AddJsonLocalization(options => options.ResourcesPath = "JsonResources");
builder.Services.Configure<RequestLocalizationOptions>(options =>
{
var supportedCultures = new[]
{
new CultureInfo("en-US"),
new CultureInfo("es"),
};
options.DefaultRequestCulture = new RequestCulture("en-US");
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
options.ApplyCurrentCultureToResponseHeaders = true;
});
builder.Services.AddMvc()
.AddViewLocalization()
.AddDataAnnotationsLocalization();
|
As I understand from you the fallback culture in the same culture set is working fine, but the fallback to the default culture is not working, right? |
Correct. Fallback from |
I will create a unit test, and then check |
Thank you, sir. |
Please check one case before I move further make sure that the requested resource is available in the default culture JSON file in your case |
We have a "PagesHome" localized string in both I removed it from |
Let me double-check or write a functional test for this case |
Of course. |
@sivashkevych seems you confused with the culture fallback. If the culture is not exists in the supported culture then the fallback will be applied in your case if the culture is Hope it solved your problem |
Anything to add here @sivashkevych? |
The default implementation of IStringLocalizer returns a string from the default culture resource if the localizer can't find the localization in the current resource.
However, the JsonStringLocalizer returns the localization string key value by default.
I've seen the PR Culture fallback to the rooted resource.
Are you going to merge it?
The text was updated successfully, but these errors were encountered: