Conversation
|
|
||
| public async Task<IEnumerable<DataLocalizedString>> GetDescriptorsAsync() | ||
| { | ||
| var descriptors = new HashSet<string>(); |
There was a problem hiding this comment.
As all of the providers are singletons, the final list can be cached.
There was a problem hiding this comment.
You are right, after the building the services the could be cached for better PERF
|
Why is this better than to have a separate public static IServiceCollection AddSharedDataLocalizedString(this IServiceCollection services, DataLocalizedString dataLocalizedString)
{
//...
return services;
}
// Or even:
public static IServiceCollection AddSharedDataLocalizedString(this IServiceCollection services, string context, string name, string value, bool resourceNotFound = false)
{
//...
return services;
} |
|
FYI, if you look at the first commit, you can configure those strings from |
|
If it's dynamic data then one should just implement a provider. Then again I don't see why we'd put multiple independent features' localized strings into the same context. |
|
Shared context could be good static localization IMHO, so let me propose another PR, then we could choose which is better to cover almost all the cases |
|
@Piedone, regarding your proposal in #18999 (comment), I did a similar thing at the beginning, then I realized that such a thing is easier for static resources Assume the case of your PR #18981. How will you provide the data if there's no provider? |
Why is shared context better? The ones in the sample in this PR are independent features, why would we bundle them together?
There need to be a provider. I'm just saying that if you want to make adding |
I don't think it's a better idea, coz the static strings come from PO files So, let's stay with what we have, but we could create a localization provider that sets the context to Do you think it's a better idea? |
|
An automatic (default) context looks like a good idea, yes. For the existing providers too. |
|
For non-default, it could be useful, but the question that might arise is how the developer will know the context that will be used in the markup?!! |
|
Well, then back to not having a shared context, and perhaps do #18999 (comment) (but I don't think this is a high priority). |

Sample usage: