Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Data Localization #4466
base: main
Are you sure you want to change the base?
Data Localization #4466
Changes from 7 commits
a126cae
129296e
1f5e087
c95b6ea
0b9b455
f62c403
c84f2b4
4589796
6a0431b
94b6599
4a1d923
9ab13e5
b7f74cf
609cf58
4194e42
25c74b8
8c6a71d
b756c6a
c20de77
0950120
2f769ae
dae05ab
66642dc
5a7e40e
7ee8f59
b418f5b
1ca4a96
3d3d7e3
3a96304
bb8787a
833eafc
01f7d86
a416e05
713e089
4c7fa54
52f1d6d
51d4922
a28a2b5
a33c2d8
1434c94
3f1d0a4
2ef68b8
3ecac03
d4e33f2
c62cd8a
75f9d48
2332b87
b7fa41b
9ca5fdc
734ffa2
1c88a22
f981fff
5ce581a
e8dedb2
9fb846a
6d78ae3
4b029f4
d6a9bce
dd10ed1
8026d0f
4191ad4
94905b6
3c9cc91
8ae7ce3
594f6ed
ca0288b
773756f
a172c7e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: identify the piece of data to localize. Needs to be a list of strings, example: "Customer" (the type), "Address" (the part), "Zip" (the field name)
For a content type, the Context is
["ContentType", "Name"]
.public string[] Context { get; }
(Key?)In a view:
D[contentType.Name, "ContentType", "Name"]
D[contentField.Name, contentType.Name, contentPart.Name, "Name"]
Maybe we don't need "Name" as part of the context, or any property, when this property is the default. We can just add this to the context when it's not the default thing of the context. Example, for content types, we don't need to add "Name" as part of the context, but we'll add "Description" for sure.
ContentTypeDataLocalizer has `LocalizedString LocalizedCategory {get;} => S["Content Types"]
When the view model is created, it will have a list of
{
LocalizedString Category {det;}
DataLocalizedString[] DataLocalizedStrings
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the editor is displayed, the DataLocalizedString are loaded from the database. The providers are also called to get the full list of localization strings. These will be grouped by localized category. Then when displayed we use the values from the database to fill the text fields. The match is done by Context keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about
IDataResourceStringProvider
might haveLocalizedCategory
which is good if we want to list all the providers from DI and display them in a single UI. IMHO it would be nice if each provider uses its own view, it could be turned on or off via the features system, this way whether the above property is a member ofIDataResourceStringProvider
or not we can display the category in the UI like a normal static localized string `S["Category Name"]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastienros seems we forgot the last parameters for the
DataLocalizer
is an argument that could be used for the name/key, so context as array may not be the right option here. I'm still thinking to use something similar to message context in POCustomer.Address.Zip
as a context