1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

Make sure the package locale pass golint

This commit is contained in:
Frédéric Guillot 2017-11-25 15:56:44 -08:00
parent db77e55119
commit f072439b79
5 changed files with 24 additions and 13 deletions

View file

@ -6,11 +6,13 @@ package locale
import "fmt"
// Language represents a language in the system.
type Language struct {
language string
translations Translation
}
// Get fetch the translation for the given key.
func (l *Language) Get(key string, args ...interface{}) string {
var translation string
@ -24,11 +26,12 @@ func (l *Language) Get(key string, args ...interface{}) string {
return fmt.Sprintf(translation, args...)
}
// Plural returns the translation of the given key by using the language plural form.
func (l *Language) Plural(key string, n int, args ...interface{}) string {
translation := key
slices, found := l.translations[key]
if found {
if found {
pluralForm, found := pluralForms[l.language]
if !found {
pluralForm = pluralForms["default"]