Skip to content

feat(localization): support localized cash shop package names - #1252

Merged
sven-n merged 1 commit into
MUnique:masterfrom
Qinjianbo:feat/cash-shop-package-localization
Oct 19, 2026
Merged

sven-n merged 1 commit into
MUnique:masterfrom
Qinjianbo:feat/cash-shop-package-localization

Conversation

@Qinjianbo

Copy link
Copy Markdown
Contributor

Cash shop package names are currently plain strings, so the catalog cannot display/edit translations or use the Configuration names workflow. This change makes them resource-backed LocalizedString values, with 203 Simplified Chinese resource entries covering the 205 built-in Season 6 packages. Catalog display, search and editing use the existing localization components; search also accepts the neutral name.

Closes #1250. The separate admin interface translations are in #1251; neither PR depends on the other.

Existing catalogs use the existing link/review/apply workflow. The fallback matches package script numbers only when unique on both sides and requires exact neutral text. Custom neutral names and translations are preserved, and repeated linking/applying is idempotent. Resource sources are registered through ConfigurationNameSources; no batch-specific update plugin or custom resource loader is added.

All 205 neutral names and all catalog parameters were compared with master and are unchanged. The existing text column reads old plain names through LocalizedStringConverter; dotnet ef migrations has-pending-model-changes reports no changes, so no empty migration is included. Client scripts and gameplay are unaffected. The operator documentation explains the workflow and distinguishes sourced Chinese terminology from descriptive translations.

Validation on current master with .NET 10:

  • Full initialization tests: 648 passed, 7 existing database-dependent tests skipped.
  • Full Web tests: 279 passed.
  • Full main tests: 1,894 passed, including item serialization, compiled models and loader generation.
  • Coverage includes fresh initialization, old-name linking, custom translations, duplicate package numbers, idempotence, converter round trips, Chinese display/search/editing and source metadata preservation.
  • Regenerated the resource accessor with MSBuild GenerateResource (StronglyTypedResourceBuilder), the EF compiled entity with dotnet ef dbcontext optimize, and the configuration loader with its generator test. No unrelated generated files are included.
  • Final rebuild introduces no warnings in changed files; all 140 focused cash shop/resource/model tests passed after accessor regeneration.
  • Previously deployed and exercised the catalog and Configuration names workflow against a local PostgreSQL database.

Reviewed against the feedback in #981, #1014, #1071, #1124 and #1182: neutral comparisons use ValueInNeutralLanguage, UI text resolves explicitly, resources use descriptive keys, and the tests do not require future neutral entries to have Chinese translations.

sven-n commented Oct 19, 2026

Copy link
Copy Markdown
Member

Review: looks good, and it follows the existing LocalizedString pattern closely.

Verified locally (head 64398d0, merged with current master together with #1251):

  • src/Startup builds with 0 errors, and the build leaves no changes to generated files.
  • MUnique.OpenMU.Tests: 1898/1898 pass.
  • MUnique.OpenMU.Web.Tests: 279/279 pass, including CashShopCatalogPageTests.
  • MUnique.OpenMU.Persistence.Initialization.Tests: 648 passed, 7 skipped, 0 failed, including CashShopUpdateTest.

Notes:

  • Persistence: the CashShopPackage.Name conversion in CashShopExtensions.Apply, the compiled model and the generated loader all match how ItemDefinition.Name is handled (value.Value ?? "" ↔ new LocalizedString(value), same text column). So existing plain names load unchanged, and no migration is needed.
  • Resources: CashShopPackageNames.resx and .zh-CN.resx have the same 203 keys, with no empty translations and no duplicate neutral values.
  • Admin panel: display and search go through GetTranslation(CurrentUICulture), and search also matches ValueInNeutralLanguage, so English names still work under a Chinese UI. Editing uses the shared LocalizedStringField.
  • Gameplay isn't affected: the package name isn't sent to the client, and outside the initializer and the catalog page nothing reads CashShopPackage.Name.

Ready to merge from my side.


Generated by Claude Code

@sven-n
sven-n merged commit dcd4919 into MUnique:master Oct 19, 2026
2 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.

Support localized cash shop package names in the admin panel

2 participants