diff --git a/pkg/i18n/grammar.go b/pkg/i18n/grammar.go index 317156f..cc1b3f2 100644 --- a/pkg/i18n/grammar.go +++ b/pkg/i18n/grammar.go @@ -356,7 +356,7 @@ func applyRegularPlural(noun string) string { // Article("hour") // "an" (silent h) func Article(word string) string { if word == "" { - return "a" + return "" } lower := strings.ToLower(strings.TrimSpace(word)) diff --git a/pkg/i18n/grammar_test.go b/pkg/i18n/grammar_test.go index 0cc56da..00780f2 100644 --- a/pkg/i18n/grammar_test.go +++ b/pkg/i18n/grammar_test.go @@ -243,7 +243,7 @@ func TestArticle(t *testing.T) { {"heir", "an"}, // Edge cases - {"", "a"}, + {"", ""}, {" error ", "an"}, } diff --git a/pkg/i18n/service.go b/pkg/i18n/service.go index 5e937b0..bb5f9f4 100644 --- a/pkg/i18n/service.go +++ b/pkg/i18n/service.go @@ -491,6 +491,8 @@ func (s *Service) Raw(messageID string, args ...any) string { return text } +// getMessage retrieves a message by language and key. +// Returns the message and true if found, or empty Message and false if not. func (s *Service) getMessage(lang, key string) (Message, bool) { msgs, ok := s.messages[lang] if !ok {