feat(04-02): load namespaced translations from embedded plugins

- Walk HasLang FS for lang/<locale>/<group>.yaml and flatten nested keys
- Publish one phrasebook.Translator before Boot with en/en defaults
- Hello plugin resolves en/pl vendor.plugin::group.key after Activate

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-18 13:47:45 +02:00
parent e7dba5c4fb
commit f824e55c81
9 changed files with 635 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
greeting: Hello
labels:
pluginName: Hello plugin

View File

@@ -0,0 +1,3 @@
greeting: Cześć
labels:
pluginName: Wtyczka Hello

View File

@@ -9,11 +9,17 @@ import (
"git.golem15.com/golem15/summercms/party"
)
var _ pact.HasConfig = (*Plugin)(nil)
var (
_ pact.HasConfig = (*Plugin)(nil)
_ pact.HasLang = (*Plugin)(nil)
)
//go:embed config
var configFS embed.FS
//go:embed lang
var langFS embed.FS
// Plugin is the golem15.hello plugin.
type Plugin struct{}
@@ -24,6 +30,7 @@ func (p *Plugin) Register(*backpack.App) error { return nil }
func (p *Plugin) Boot(*backpack.App) error { return nil }
func (p *Plugin) ConfigFS() fs.FS { return configFS }
func (p *Plugin) LangFS() fs.FS { return langFS }
func init() {
party.Register(&Plugin{})