Skip to content

Add Data Localization Contexts to OrchardCoreConstants#19022

Merged
hishamco merged 14 commits into
mainfrom
hishamco/data-context-const
Apr 9, 2026
Merged

Add Data Localization Contexts to OrchardCoreConstants#19022
hishamco merged 14 commits into
mainfrom
hishamco/data-context-const

Conversation

@hishamco
Copy link
Copy Markdown
Member

@hishamco hishamco commented Mar 19, 2026

Fixes #19034

@hishamco hishamco requested a review from gvkries March 19, 2026 09:38
@sebastienros
Copy link
Copy Markdown
Member

Let's talk about our options here, don't do any changes until we agree on something though.

What about using specific constant classes instead of nesting even more ones. So instead of ORchardCoreConstants.DataLocalizationContext.ContentTypes, why not DataLocalizationConstants.ContentTypesContext, or DataLocalizationContexts.ContentTypes, other suggestions?

Trying to make it easier to read and type, it could get out of control otherwise.

Also maybe the fields one could use a function instead of concatenating, like DataLocalizationContext.ContentFields(string fieldName), suggestions again, let's talk before we act.

@hishamco
Copy link
Copy Markdown
Member Author

I will open a discussion thread then

@gvkries
Copy link
Copy Markdown
Member

gvkries commented Mar 23, 2026

I'd say don't put it into a class called constants if it includes method. IMHO a simple DataLocalizationContexts for all contexts, including methods for fields and e.g. permissions, would be sufficient.

@hishamco
Copy link
Copy Markdown
Member Author

@gvkries, please move your comment to the issue #19034 then we can take an action after that I can react to the changes

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hishamco hishamco force-pushed the hishamco/data-context-const branch from c80e0fe to 91ef38f Compare March 24, 2026 09:10
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hishamco hishamco force-pushed the hishamco/data-context-const branch from 4fc8dc8 to 9cb5aa6 Compare March 24, 2026 09:25
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hishamco hishamco requested a review from gvkries March 24, 2026 10:31
@sebastienros
Copy link
Copy Markdown
Member

I think we should have ContentType(s) in the a library for Content Types (Core, Abstractions, or the module itself if only used locally). Same for content fields or admin menu. Otherwise we'll get every single module leaking in the localization abstractions. And not be an abstractions package anymore.

@hishamco
Copy link
Copy Markdown
Member Author

hishamco commented Apr 3, 2026

@gvkries, could you please check the permissions & admin menus changes? If this is what you discussed in the triage meeting, I will complete the PR ASAP; otherwise, let me know if there's anything else I should take into account

@hishamco
Copy link
Copy Markdown
Member Author

hishamco commented Apr 9, 2026

@gvkries, can you check to move on this one

@gvkries
Copy link
Copy Markdown
Member

gvkries commented Apr 9, 2026

I think what you've done for the admin menu and permissions is good. Just apply that to content types/fields as well, so we don't have the constants in the localization abstractions, but in the related modules (or their abstractions).

@hishamco
Copy link
Copy Markdown
Member Author

hishamco commented Apr 9, 2026

@gvkries, please review and merge if all goes well

Copy link
Copy Markdown
Member

@gvkries gvkries left a comment

Choose a reason for hiding this comment

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

LGTM in general, but please check my few comments.


namespace OrchardCore.AdminMenu.Services;

public class AdminMenuItemDataLocalizationProvider : ILocalizationDataProvider
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this removed? Is it the same as another provider?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe do this change in another PR, also the ListsAdminNodeDataLocalizationProvider probably needs to be renamed (the one in LinkAdminNodeDataLocalizationProvider.cs).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Why is this removed? Is it the same as another provider?

Let me check ..

Maybe do this change in another PR, also the ListsAdminNodeDataLocalizationProvider probably needs to be renamed (the one in LinkAdminNodeDataLocalizationProvider.cs).

Sure

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@gvkries I remember this no long need coz both admin menus and menu items are using the same provider. This was mentioned a few weeks ago in the steering meeting

<ProjectReference Include="..\..\OrchardCore\OrchardCore.Admin.Abstractions\OrchardCore.Admin.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.AdminMenu.Abstractions\OrchardCore.AdminMenu.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.AuditTrail.Abstractions\OrchardCore.AuditTrail.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.ContentFields.Core\OrchardCore.ContentFields.Core.csproj" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is required by the ContentFieldLocalizationDataProvider, right? Isn't it better to move the ContentFieldLocalizationDataProvider to the content fields module in that case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is in mind before this PR, but I remember its stay here to avoid module-to-module dependency. I might check this later after this PR

@hishamco hishamco requested a review from gvkries April 9, 2026 13:20
@hishamco
Copy link
Copy Markdown
Member Author

hishamco commented Apr 9, 2026

@gvkries, I added a commit before I noticed your approval. Shall I revert my last commit?

Also, let me know which rename you are refer to in #19022 (comment)

@gvkries
Copy link
Copy Markdown
Member

gvkries commented Apr 9, 2026

I think this is fine. For the renaming, look at LinkAdminNodeDataLocalizationProvider.cs.

@hishamco hishamco merged commit cb19961 into main Apr 9, 2026
6 checks passed
@hishamco hishamco deleted the hishamco/data-context-const branch April 9, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centrlize the Data Localization Contexts

3 participants