1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

refactor(locale): avoid code duplication in Printer.Printf() function

This commit is contained in:
Julien Voisin 2025-08-16 03:02:25 +02:00 committed by GitHub
parent dd8011a4aa
commit 40fa77851c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.