From 59497de8dc5e58f3bae7c9dd37319ffa8e732782 Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 27 Sep 2018 20:29:16 +1000 Subject: [PATCH] Flatten out the Errors map in the phrase files. --- common/phrases.go | 10 +++++----- langs/english.json | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/common/phrases.go b/common/phrases.go index bb248ba0..1bba07a3 100644 --- a/common/phrases.go +++ b/common/phrases.go @@ -46,7 +46,7 @@ type LanguagePack struct { UserAgents map[string]string OperatingSystems map[string]string HumanLanguages map[string]string - Errors map[string]map[string]string // map[category]map[name]value + Errors map[string]string NoticePhrases map[string]string PageTitles map[string]string TmplPhrases map[string]string @@ -205,12 +205,12 @@ func GetHumanLangPhrase(name string) (string, bool) { } // TODO: Does comma ok work with multi-dimensional maps? -func GetErrorPhrase(category string, name string) string { - res, ok := currentLangPack.Load().(*LanguagePack).Errors[category][name] +func GetErrorPhrase(name string) (string, bool) { + res, ok := currentLangPack.Load().(*LanguagePack).Errors[name] if !ok { - return getPhrasePlaceholder("error", name) + return getPhrasePlaceholder("error", name), false } - return res + return res, true } func GetNoticePhrase(name string) string { diff --git a/langs/english.json b/langs/english.json index 86b91c9b..7452a9c1 100644 --- a/langs/english.json +++ b/langs/english.json @@ -70,8 +70,6 @@ }, "Errors": { - "NoPerms": { - } }, "PageTitles": {