refactor(i18n): align helper formatting with core primitives
All checks were successful
Security Scan / security (push) Successful in 14s
Test / test (push) Successful in 2m19s

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 12:59:09 +00:00
parent d8355d241f
commit 852b11fda5
3 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,7 @@
package i18n
import "dappco.re/go/core"
// SetDebug enables or disables debug mode on the default service.
func SetDebug(enabled bool) {
withDefaultService(func(svc *Service) { svc.SetDebug(enabled) })
@ -18,5 +20,5 @@ func (s *Service) Debug() bool {
}
func debugFormat(key, text string) string {
return "[" + key + "] " + text
return core.Sprintf("[%s] %s", key, text)
}

View file

@ -3,7 +3,6 @@ package i18n
import (
"bytes"
"io/fs"
"strings"
"text/template"
"dappco.re/go/core"
@ -308,7 +307,7 @@ func namespaceLookupKey(namespace, key string) string {
if namespace != "" && key == namespace {
return key
}
if namespace != "" && strings.HasPrefix(key, namespace+".") {
if namespace != "" && core.HasPrefix(key, namespace+".") {
return key
}
if namespace == "" {

View file

@ -1,8 +1,7 @@
package i18n
import (
"fmt"
"strings"
"dappco.re/go/core"
)
// ServiceState captures the current configuration of a service in one
@ -24,9 +23,9 @@ type ServiceState struct {
func (s ServiceState) String() string {
langs := "[]"
if len(s.AvailableLanguages) > 0 {
langs = "[" + strings.Join(s.AvailableLanguages, ", ") + "]"
langs = "[" + core.Join(", ", s.AvailableLanguages...) + "]"
}
return fmt.Sprintf(
return core.Sprintf(
"ServiceState{language=%q fallback=%q mode=%s formality=%s location=%q direction=%s rtl=%t debug=%t available=%s handlers=%d}",
s.Language,
s.Fallback,