Skip to content

Conversation

Copy link

Copilot AI commented Dec 1, 2025

Generic types like AppIdentityUser<T> produce unwieldy resource filenames (e.g., AppIdentityUser1[[System.String, System.Private.CoreLib, ...]].fr.json`). This adds an option to strip generic markers for simpler naming.

Ref: http://hishambinateya.com/localization-and-generics

Changes

  • JsonLocalizationOptions: Added UseGenericResources property (default true for backward compatibility)
  • JsonStringLocalizerFactory: Added TryStripGenericTypeMarkers() that removes backtick and type arguments when UseGenericResources = false
  • Applied stripping in both Create(Type) and Create(string, string) overloads

Usage

services.AddJsonLocalization(options =>
{
    options.ResourcesPath = "Resources";
    options.UseGenericResources = false; // GenericClass<T> → GenericClass.fr.json
});

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • web.archive.org
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Localization & Generics</issue_title>
<issue_description>Please refer to http://hishambinateya.com/localization-and-generics</issue_description>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Update localization and generics implementation Add UseGenericResources option for simpler generic type resource naming Dec 1, 2025
Copilot AI requested a review from hishamco December 1, 2025 01:52
Copilot finished work on behalf of hishamco December 1, 2025 01:52
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.

Localization & Generics

2 participants