1
0
Fork 0
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:
jvoisin 2024-02-28 16:08:20 +01:00 committed by Frédéric Guillot
parent f274394f0e
commit 48fa64f8ec
2 changed files with 17 additions and 34 deletions

View file

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