Skip to content

Move JS localization endpoint out of Media into a generic Localization feature - #19854

Open
Skrypt wants to merge 3 commits into
mainfrom
skrypt/localization-js-endpoint
Open

Move JS localization endpoint out of Media into a generic Localization feature#19854
Skrypt wants to merge 3 commits into
mainfrom
skrypt/localization-js-endpoint

Conversation

@Skrypt

@Skrypt Skrypt commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

The anonymous api/media/localizations endpoint only served the "media-gallery" IJSLocalizer group, and only existed when Media was enabled — any other module wanting to expose JS localizations to a standalone/client-side app had no generic way to do so.

Replaces it with a generic GET api/localization/js/{group} endpoint (comma-separated groups supported), hosted by a new, independently toggleable feature OrchardCore.Localization.Js, so any module's IJSLocalizer registrations can be served without depending on Media or on the main Localization feature. A group whose owning module isn't enabled simply contributes no keys, leaving the caller's own base-language defaults in place.

What changed

  • New OrchardCore.Localization.Js feature: GetJavaScriptLocalizationsEndpoint.cs (OrchardCore.Localization), manifest/startup registration.
  • Removed the old Media-specific GetLocalizationsEndpoint.cs (api/media/localizations).
  • Standalone Media Gallery recipes (media-api-standalone.recipe.json, media-api-standalone-localhost.recipe.json) now enable OrchardCore.Localization.Js; the standalone app calls the new route.
  • The embedded admin gallery is unaffected — it already renders localizations server-side via Orchard.GetJSLocalizations.
  • Regenerated the NSwag OpenAPI client (OpenApiClient.cs/OpenApiClient.ts) to reflect the new endpoint.
  • Updated docs: new JavaScript Localization reference page section, MediaGallery.md, and 4.0.0.md release notes.

Testing

  • dotnet build -c Release -p:TreatWarningsAsErrors=true --warnaserror -p:RunAnalyzers=true — clean, 0 warnings/errors.

🤖 Generated with Claude Code

Skrypt and others added 2 commits September 10, 2026 14:04
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n feature

The anonymous api/media/localizations endpoint only served the "media-gallery"
IJSLocalizer group and only existed when Media was enabled. Replace it with a
generic GET api/localization/js/{group} endpoint (comma-separated groups
supported) hosted by a new, independently toggleable feature,
OrchardCore.Localization.Js, so any module's IJSLocalizer registrations can be
served without depending on Media or on the main Localization feature. A group
whose owning module isn't enabled simply contributes no keys, leaving the
caller's own base-language defaults in place.

The standalone Media Gallery recipes now enable OrchardCore.Localization.Js
and the standalone app calls the new route. The embedded admin gallery is
unaffected since it already renders localizations server-side via
Orchard.GetJSLocalizations. Regenerated the NSwag OpenAPI client and updated
the Media Gallery, JS localization, and 4.0.0 release docs accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hishamco

Copy link
Copy Markdown
Member

I will have a look after OC Harvest

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