Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Changes ResourcesPath property to string[] to support loading JSON localization resources from multiple directories.

Changes

  • JsonLocalizationOptions: Changed ResourcesPath from string to string[] (breaking change for v4.0.0)
  • JsonResourceManager:
    • Updated to accept string[] of paths and search all locations for resources
    • Merges resources from all paths (earlier paths take precedence on key conflicts)
    • Sets up file watchers for all paths to support hot-reload
    • Tracks loaded files to avoid redundant I/O

Usage

services.AddJsonLocalization(options =>
{
    options.ResourcesPath = new[] { "Resources", "SharedResources", "PluginResources" };
});

Resources are loaded in order: first path takes precedence on key conflicts.

Original prompt

This section details on the original issue you should resolve

<issue_title>Ability to load resources from multiple locations</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add ability to load resources from multiple locations Add support for loading resources from multiple locations Dec 1, 2025
Copilot AI requested a review from hishamco December 1, 2025 01:32

public string ResourcesPath { get; }

public string[] AdditionalResourcesPaths { get; }
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot we could change ResourcesPath instead of introducing a new property

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean changing ResourcesPath from a single string to a collection (like IList<string>), so users can specify multiple paths directly? That would be a breaking change for existing users since it changes the type. Could you clarify the preferred approach?

Copy link
Owner

Choose a reason for hiding this comment

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

Use string[] instead as the return type. Don't worry about the breaking change, this will be included as part of the 4.0.0 release

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot, apply the changes based on my above comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed ResourcesPath from string to string[] in commit ec0bb44. Removed the separate AdditionalResourcesPaths property.

@hishamco hishamco marked this pull request as ready for review December 10, 2025 01:34
@hishamco hishamco merged commit 8723438 into main Dec 10, 2025
1 check passed
@hishamco hishamco deleted the copilot/add-resource-loading-support branch December 10, 2025 01:38
@hishamco hishamco added this to the 4.0.0 milestone Dec 10, 2025
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.

Ability to load resources from multiple locations

2 participants