feat(i18n): add current debug getter
All checks were successful
Security Scan / security (push) Successful in 12s
Test / test (push) Successful in 1m23s

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-01 23:59:26 +00:00
parent 7e827ab3ce
commit 9502bef6da
2 changed files with 22 additions and 0 deletions

View file

@ -33,6 +33,20 @@ func TestSetDebug_Good_ServiceLevel(t *testing.T) {
assert.False(t, svc.Debug())
}
func TestCurrentDebug_Good_PackageLevel(t *testing.T) {
svc, err := New()
require.NoError(t, err)
_ = Init()
SetDefault(svc)
SetDebug(true)
assert.True(t, CurrentDebug())
SetDebug(false)
assert.False(t, CurrentDebug())
}
func TestDebugFormat_Good(t *testing.T) {
tests := []struct {
name string

View file

@ -69,6 +69,14 @@ func CurrentFormality() Formality {
return FormalityNeutral
}
// CurrentDebug reports whether debug mode is enabled on the default service.
func CurrentDebug() bool {
if svc := Default(); svc != nil {
return svc.Debug()
}
return false
}
// N formats a number using the i18n.numeric.* namespace.
//
// N("number", 1234567) // "1,234,567"