mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Use a switch-case construct in internal/locale/plural.go instead of an avalanche of if-if-if-if-if
Less lines or code and marginally greater readability, yay! Oh and also preallocate a map in LoadCatalogMessages just because we can.
This commit is contained in:
parent
f274394f0e
commit
48fa64f8ec
2 changed files with 17 additions and 34 deletions
|
@ -20,7 +20,7 @@ var translationFiles embed.FS
|
|||
// LoadCatalogMessages loads and parses all translations encoded in JSON.
|
||||
func LoadCatalogMessages() error {
|
||||
var err error
|
||||
defaultCatalog = make(catalog)
|
||||
defaultCatalog = make(catalog, len(AvailableLanguages()))
|
||||
|
||||
for language := range AvailableLanguages() {
|
||||
defaultCatalog[language], err = loadTranslationFile(language)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue