Standalone grammar-aware translation engine with: - 3-tier verb/noun fallback (JSON locale → irregular maps → regular rules) - 6 built-in i18n.* namespace handlers (label, progress, count, done, fail, numeric) - Nested en.json with gram/prompt/time/lang sections (no flat command keys) - CLDR plural rules for 10 languages - Subject fluent API, number/time formatting, RTL detection - 55 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
441 B
Go
24 lines
441 B
Go
package i18n
|
|
|
|
// SetDebug enables or disables debug mode on the default service.
|
|
func SetDebug(enabled bool) {
|
|
if svc := Default(); svc != nil {
|
|
svc.SetDebug(enabled)
|
|
}
|
|
}
|
|
|
|
func (s *Service) SetDebug(enabled bool) {
|
|
s.mu.Lock()
|
|
defer s.mu.Unlock()
|
|
s.debug = enabled
|
|
}
|
|
|
|
func (s *Service) Debug() bool {
|
|
s.mu.RLock()
|
|
defer s.mu.RUnlock()
|
|
return s.debug
|
|
}
|
|
|
|
func debugFormat(key, text string) string {
|
|
return "[" + key + "] " + text
|
|
}
|