diff --git a/debug.go b/debug.go index de6739c..898acb4 100644 --- a/debug.go +++ b/debug.go @@ -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) } diff --git a/i18n.go b/i18n.go index a5e820b..7f83c04 100644 --- a/i18n.go +++ b/i18n.go @@ -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 == "" { diff --git a/state.go b/state.go index 9c3501c..bb18608 100644 --- a/state.go +++ b/state.go @@ -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,