|
|
@@ -25,12 +25,9 @@ func (p *Printer) Print(key string) string {
|
|
|
func (p *Printer) Printf(key string, args ...any) string {
|
|
|
translation := key
|
|
|
|
|
|
- str, found := dict[key]
|
|
|
- if found {
|
|
|
- var valid bool
|
|
|
- translation, valid = str.(string)
|
|
|
- if !valid {
|
|
|
if dict, err := getTranslationDict(p.language); err == nil {
|
|
|
+ if str, ok := dict[key]; ok {
|
|
|
+ if translation, ok = str.(string); !ok {
|
|
|
translation = key
|
|
|
}
|
|
|
}
|
|
|
@@ -50,12 +47,12 @@ func (p *Printer) Plural(key string, n int, args ...interface{}) string {
|
|
|
var plurals []string
|
|
|
|
|
|
switch v := choices.(type) {
|
|
|
- case []interface{}:
|
|
|
+ case []string:
|
|
|
+ plurals = v
|
|
|
+ case []any:
|
|
|
for _, v := range v {
|
|
|
plurals = append(plurals, fmt.Sprint(v))
|
|
|
}
|
|
|
- case []string:
|
|
|
- plurals = v
|
|
|
default:
|
|
|
return key
|
|
|
}
|