fix: localize page builder form labels and permission-denied message (KGM-3903, KGM-4190/4183)#1083
Open
zhangshanwen wants to merge 1 commit into
Open
Conversation
…(KGM-3903, KGM-4190/4183) Two i18n bugs where the JP UI rendered English text: KGM-3903 — Page Categories "New" form field labels (Name/Path/Description) showed English in the JP locale. The default field-label lookup goes through presets.ModelsI18nModuleKey, which only the host app can register (RegisterForModule is last-writer-wins per module+lang), so the framework cannot register there. Fix: translate the category editing-form labels from the page builder's own I18nPageBuilderKey messages via presets.WrapperFieldLabel, mirroring the listing column labels. Any app embedding pagebuilder now gets localized labels. KGM-4190/4183 — the "permission denied" message was rendered as the raw English perm.PermissionDenied.Error() string at every display site (ShowMessage / vErr.GlobalError / page body / UpdateOverlayContent), never translated. Fix: add Messages.PermissionDenied (CoreI18nModuleKey, en/zh/ja) and render MustGetMessages(ctx.R).PermissionDenied at every user-facing display site. The sentinel error itself is unchanged (still used for errors.Is control flow). Tests: example/integration/pagebuilder_category_i18n_test.go (JP category form labels) and a JP case added to TestPageBuilderPerm (JP permission-denied text). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Go | Jun 16, 2026 7:27a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Transmigration-zhou
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix two i18n bugs where the Japanese admin UI rendered untranslated English text.
KGM-3903 — Page Categories "New" form shows English field labels in JP
Form field labels are resolved via
i18n.PT(ctx.R, presets.ModelsI18nModuleKey, modelLabel, fieldLabel). For the Page Categories model the lookup keys (PageCategoriesName/Path/Description) were never registered for any locale, so they fell back to the English humanized field names in the JP locale.ModelsI18nModuleKeycan't be registered from the framework —i18n.RegisterForModuleis last-writer-wins per(module, lang), so the host app is its single owner. Instead, the page builder now translates its category editing-form labels from its ownI18nPageBuilderKeymessages viapresets.WrapperFieldLabel, mirroring the listing column labels (CustomizeColumnLabel). Any app embedding pagebuilder gets localized labels automatically.KGM-4190 / KGM-4183 — "permission denied" shown in English in JP
perm.PermissionDenied(github.com/qor5/x/v3/perm) is a static Englisherrors.New("permission denied"), and presets renderedperm.PermissionDenied.Error()directly at ~18 display sites, bypassing i18n.Added
Messages.PermissionDenied(CoreI18nModuleKey; enpermission denied/ zh没有权限/ ja権限がありません) and now renderMustGetMessages(ctx.R).PermissionDeniedat every user-facing display site (ShowMessage,vErr.GlobalError, page bodyh.Text, andEditingBuilder.UpdateOverlayContent). The sentinel error itself is unchanged — still used forerrors.Iscontrol flow.Tests
example/integration/pagebuilder_category_i18n_test.go— Page Categories New form renders Japanese labels (名前/パス/説明) underAccept-Language: ja, English underen.TestPageBuilderPerm— new JP case asserts the permission-denied text is権限がありません(and notpermission denied).example/integrationsuite,presets/...(105) and docs permission tests all pass; default English locale unchanged (no regression).🤖 Generated with Claude Code