diff --git a/state.go b/state.go index 4dbc9ae..018fe9f 100644 --- a/state.go +++ b/state.go @@ -1,6 +1,8 @@ package i18n import ( + "strings" + "dappco.re/go/core" ) @@ -82,7 +84,7 @@ func (s ServiceState) String() string { names = append(names, "") continue } - names = append(names, core.Sprintf("%T", handler)) + names = append(names, shortHandlerTypeName(handler)) } handlers = "[" + core.Join(", ", names...) + "]" } @@ -104,6 +106,14 @@ func (s ServiceState) String() string { ) } +func shortHandlerTypeName(handler KeyHandler) string { + name := core.Sprintf("%T", handler) + if idx := strings.LastIndex(name, "."); idx >= 0 { + name = name[idx+1:] + } + return strings.TrimPrefix(name, "*") +} + func (s *Service) State() ServiceState { if s == nil { return defaultServiceStateSnapshot()