refactor(html): add AX docs to helper wrappers
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
fd1f7cea74
commit
9b620cf673
3 changed files with 20 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
)
|
||||
|
||||
// cmd/wasm/register.go: buildComponentJS takes a JSON slot map and returns the WC bundle JS string.
|
||||
// Example: js, err := buildComponentJS(`{"H":"site-header","C":"app-content"}`).
|
||||
// This is the pure-Go part testable without WASM.
|
||||
// Excluded from WASM builds — encoding/json and text/template are too heavy.
|
||||
// Use cmd/codegen/ CLI instead for build-time generation.
|
||||
|
|
|
|||
17
deps/go-i18n/i18n.go
vendored
17
deps/go-i18n/i18n.go
vendored
|
|
@ -5,19 +5,21 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// Service is a minimal translation service for local verification.
|
||||
// deps/go-i18n/i18n.go: Service is a minimal translation service for local verification.
|
||||
type Service struct {
|
||||
language string
|
||||
}
|
||||
|
||||
var defaultService = &Service{}
|
||||
|
||||
// New returns a new service.
|
||||
// deps/go-i18n/i18n.go: New returns a new translation service.
|
||||
// Example: svc, err := New().
|
||||
func New() (*Service, error) {
|
||||
return &Service{}, nil
|
||||
}
|
||||
|
||||
// SetDefault sets the process-wide default service.
|
||||
// deps/go-i18n/i18n.go: SetDefault sets the process-wide default service.
|
||||
// Example: SetDefault(svc).
|
||||
func SetDefault(svc *Service) {
|
||||
if svc == nil {
|
||||
svc = &Service{}
|
||||
|
|
@ -25,7 +27,8 @@ func SetDefault(svc *Service) {
|
|||
defaultService = svc
|
||||
}
|
||||
|
||||
// SetLanguage records the active language for locale-aware lookups.
|
||||
// deps/go-i18n/i18n.go: SetLanguage records the active language for locale-aware lookups.
|
||||
// Example: _ = svc.SetLanguage("en-GB").
|
||||
func (s *Service) SetLanguage(language string) error {
|
||||
if s == nil {
|
||||
return nil
|
||||
|
|
@ -42,12 +45,14 @@ func (s *Service) SetLanguage(language string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// T returns a translated string for key.
|
||||
// deps/go-i18n/i18n.go: T returns a translated string for key.
|
||||
// Example: label := T("prompt.yes").
|
||||
func T(key string, args ...any) string {
|
||||
return defaultService.T(key, args...)
|
||||
}
|
||||
|
||||
// T returns a translated string for key.
|
||||
// deps/go-i18n/i18n.go: T returns a translated string for key.
|
||||
// Example: label := svc.T("prompt.yes").
|
||||
func (s *Service) T(key string, args ...any) string {
|
||||
if s != nil {
|
||||
switch key {
|
||||
|
|
|
|||
11
deps/go-log/log.go
vendored
11
deps/go-log/log.go
vendored
|
|
@ -5,7 +5,8 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
// E wraps an error with scope and message.
|
||||
// deps/go-log/log.go: E wraps an error with scope and message.
|
||||
// Example: err := E("cmd/scan", "load manifest", io.EOF).
|
||||
func E(scope, message string, err error) error {
|
||||
if err == nil {
|
||||
return errors.New(scope + ": " + message)
|
||||
|
|
@ -13,8 +14,12 @@ func E(scope, message string, err error) error {
|
|||
return fmt.Errorf("%s: %s: %w", scope, message, err)
|
||||
}
|
||||
|
||||
// Error writes an error-level message. This stub is a no-op for tests.
|
||||
// deps/go-log/log.go: Error writes an error-level message.
|
||||
// Example: Error("manifest validation failed", "path", path).
|
||||
// This stub is a no-op for tests.
|
||||
func Error(msg string, _ ...any) {}
|
||||
|
||||
// Info writes an info-level message. This stub is a no-op for tests.
|
||||
// deps/go-log/log.go: Info writes an info-level message.
|
||||
// Example: Info("registry reloaded", "count", 3).
|
||||
// This stub is a no-op for tests.
|
||||
func Info(msg string, _ ...any) {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue