From 40fa77851c98023f822458b1d7bb7c3295490257 Mon Sep 17 00:00:00 2001 From: Julien Voisin Date: Sat, 16 Aug 2025 03:02:25 +0200 Subject: [PATCH] refactor(locale): avoid code duplication in `Printer.Printf()` function --- internal/locale/printer.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/internal/locale/printer.go b/internal/locale/printer.go index 238f2372..c3b0691e 100644 --- a/internal/locale/printer.go +++ b/internal/locale/printer.go @@ -26,15 +26,7 @@ func (p *Printer) Print(key string) string { // Printf is like fmt.Printf, but using language-specific formatting. func (p *Printer) Printf(key string, args ...any) string { - translation := key - - if dict, err := getTranslationDict(p.language); err == nil { - if str, ok := dict.singulars[key]; ok { - translation = str - } - } - - return fmt.Sprintf(translation, args...) + return fmt.Sprintf(p.Print(key), args...) } // Plural returns the translation of the given key by using the language plural form.