Skip to content

Add optional localization support for form labels - #12

Merged
Apollo3zehn merged 7 commits into
Apollo3zehn:devfrom
Marck21:dev
Jan 12, 2026
Merged

Add optional localization support for form labels#12
Apollo3zehn merged 7 commits into
Apollo3zehn:devfrom
Marck21:dev

Conversation

@Marck21

@Marck21 Marck21 commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds optional localization (i18n) support to BlazorJsonForm.

Labels, helper texts and dictionary captions can now be localized using schema extensions, while keeping full backward compatibility.

How it works

  • Localization is enabled by registering an IJsonFormLocalizer implementation.
  • Schema extensions such as x-label, x-helperText, x-keyLabel and x-valueLabel are treated as localization keys.
  • If no localizer is registered, or no key is provided, the original behavior is preserved.

Key points

  • ✅ Fully backward-compatible
  • ✅ No breaking changes
  • ✅ Opt-in feature
  • ✅ Works with existing localization systems (IStringLocalizer, etc.)

Example

builder.Services.AddScoped<IJsonFormLocalizer, Localizer>();
[property: JsonSchemaExtension("x-label", "EngineCount_label")]
int EngineCount

Documentation

The README has been updated with a new section describing how to enable and use localization.

@Apollo3zehn

Copy link
Copy Markdown
Owner

Hi, thank you very much for your contribution which seems to be very useful for this project!

I would like to merge it but I have to review first and that is a bit difficult because it seems you have applied some auto-formatter and the PR now consists or > 1000 changed lines. Could you please clean up the PR so that it only contains the actual changes? That would be great. Thanks again for your contribution! :-)

@Marck21

Marck21 commented Jan 12, 2026

Copy link
Copy Markdown
Contributor Author

Hi,

Thanks for reviewing the PR! Apologies for the formatting issues. I've cleaned it up and removed unnecessary changes. The PR now only contains the relevant updates.

I've pushed the updated version. Let me know if everything looks good!

Thanks again,

@Apollo3zehn

Copy link
Copy Markdown
Owner

I made a small commit to ensure that x-label will work also without IJsonFormLocalizer so that the behavior is consistent with x-keyLabel and x-valueLabel as well as x-helperText and I made changes to the README to clarify this behavior a little bit.

Thank you very much for that contribution, this will be very useful to other including myself!

@Apollo3zehn
Apollo3zehn merged commit 80fd886 into Apollo3zehn:dev Jan 12, 2026
2 of 3 checks passed
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.

2 participants