Skip to content

could we have a missing localization handler? #3579

@cairabbit

Description

@cairabbit

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When I saw a lot of log entries for missing localization items like below:
"JsonStringLocalizer" searched for '"No data found."' in '"XXX.UIStrings"' with culture '"zh-CN"' not found.

I want to add those items. However, it's not easy to find all the missing items from the log. Could we have a IMissingLocalizationHandler which would handle those missing items. for example: I can use it to write the missing items into a temp json file. Then I can add these items in the json file to existing localization json files or resx files.

Describe the solution you'd like

in JsonStringLocalizer.cs

    private void LogSearchedLocation(string name)
    {
        _missingLocalizationHandler.HandleMissingLocalizationItem(name, typeName, CultureInfo.CurrentUICulture.Name);
        if (!ignoreLocalizerMissing)
        {
            Logger.LogInformation("{JsonStringLocalizerName} searched for '{Name}' in '{TypeName}' with culture '{CultureName}' not found.", nameof(JsonStringLocalizer), name, typeName, CultureInfo.CurrentUICulture.Name);
        }
    }

there could be an NullMissingLocalizationHanlder, which does nothing.

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions