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:
parent
db77e55119
commit
f072439b79
5 changed files with 24 additions and 13 deletions
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue