[PR #228] feat: add JSON-based localization system with culture support #309

Closed
opened 2026-03-07 19:57:32 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/Corsinvest/cv4pve-admin/pull/228

State: closed
Merged: Yes


Summary

  • Add JsonLocalizationService: loads translations from embedded resources and external files; in DEBUG registers missing keys directly to source.json in the repo
  • Add JsonLocalizerFactory and ServiceCollectionExtensions for DI wiring
  • Add UserSettings for per-user preferences (culture)
  • Add HttpResponseExtensions.AppendCultureCookie helper
  • Add SettingsHelper.CreateSettingsAccordion<T> generic factory (moved from Module.System)
  • Extend ApplicationHelper: TranslationsPath, DefaultCulture, CookieCultureName
  • Embed translations/*.json (excluding source.json) as EmbeddedResource in csproj
  • Register translations/ directory creation on app startup
  • source.json: 1015 unique keys extracted from all EE .razor/.razor.cs files, non-ASCII chars escaped as \uXXXX

Test plan

  • App starts without errors with localization registered
  • In DEBUG, unknown L["key"] entries are appended to source.json in the repo source
  • Translations load from embedded resource for supported cultures
**Original Pull Request:** https://github.com/Corsinvest/cv4pve-admin/pull/228 **State:** closed **Merged:** Yes --- ## Summary - Add `JsonLocalizationService`: loads translations from embedded resources and external files; in DEBUG registers missing keys directly to `source.json` in the repo - Add `JsonLocalizerFactory` and `ServiceCollectionExtensions` for DI wiring - Add `UserSettings` for per-user preferences (culture) - Add `HttpResponseExtensions.AppendCultureCookie` helper - Add `SettingsHelper.CreateSettingsAccordion<T>` generic factory (moved from `Module.System`) - Extend `ApplicationHelper`: `TranslationsPath`, `DefaultCulture`, `CookieCultureName` - Embed `translations/*.json` (excluding `source.json`) as `EmbeddedResource` in csproj - Register `translations/` directory creation on app startup - `source.json`: 1015 unique keys extracted from all EE `.razor`/`.razor.cs` files, non-ASCII chars escaped as `\uXXXX` ## Test plan - [ ] App starts without errors with localization registered - [ ] In DEBUG, unknown `L["key"]` entries are appended to `source.json` in the repo source - [ ] Translations load from embedded resource for supported cultures
kerem 2026-03-07 19:57:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-admin#309
No description provided.