32 lines
1.4 KiB
Markdown
32 lines
1.4 KiB
Markdown
---
|
|
created: 2026-10-07T16:31:50.525Z
|
|
title: Translate Messages as a Nuxt i18n JSON editor
|
|
area: sm-translate-plugin
|
|
severity: minor
|
|
files:
|
|
- ../sm-translate-plugin/admin_settings.go
|
|
- modules/pact/capabilities.go (SettingsItem.Controller)
|
|
- ../examples/golem15-wintercms-starter/plugins/golem15/translate/Plugin.php (registerSettings: messages)
|
|
---
|
|
|
|
## Problem
|
|
|
|
WinterCMS translate registers two settings entries: Locales and Messages. Messages
|
|
manages CMS theme Twig strings such as `{{ 'x.y.z'|_ }}`, stored in a messages table.
|
|
SummerCMS apps are headless and have no server-rendered theme strings, so the Go port
|
|
(quick 261007-p4y) registers only Locales. The frontend strings live in the Nuxt app's
|
|
i18n locale JSON files, which admins currently cannot edit.
|
|
|
|
## Solution
|
|
|
|
Integrate Nuxt i18n with the translate plugin as an i18n JSON editor, not a
|
|
WinterCMS-style messages table:
|
|
- admin screen edits per-locale message keys (nested JSON, one column per enabled
|
|
Locale), with missing-key highlighting against the default locale;
|
|
- the backend serves the merged messages to the Nuxt app (e.g. a lazy-load endpoint
|
|
per locale that @nuxtjs/i18n can fetch), with the bundled JSON as fallback;
|
|
- register as a second controller-link settings entry (`pact.SettingsItem.Controller`)
|
|
under the Translate category, next to Locales.
|
|
Open questions: storage (DB rows vs. versioned JSON), how keys are discovered/synced
|
|
from the Nuxt repo, caching and invalidation on edit.
|