Flatten out the Errors map in the phrase files.
This commit is contained in:
parent
e9a9441e93
commit
59497de8dc
|
@ -46,7 +46,7 @@ type LanguagePack struct {
|
||||||
UserAgents map[string]string
|
UserAgents map[string]string
|
||||||
OperatingSystems map[string]string
|
OperatingSystems map[string]string
|
||||||
HumanLanguages 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
|
NoticePhrases map[string]string
|
||||||
PageTitles map[string]string
|
PageTitles map[string]string
|
||||||
TmplPhrases 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?
|
// TODO: Does comma ok work with multi-dimensional maps?
|
||||||
func GetErrorPhrase(category string, name string) string {
|
func GetErrorPhrase(name string) (string, bool) {
|
||||||
res, ok := currentLangPack.Load().(*LanguagePack).Errors[category][name]
|
res, ok := currentLangPack.Load().(*LanguagePack).Errors[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return getPhrasePlaceholder("error", name)
|
return getPhrasePlaceholder("error", name), false
|
||||||
}
|
}
|
||||||
return res
|
return res, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetNoticePhrase(name string) string {
|
func GetNoticePhrase(name string) string {
|
||||||
|
|
|
@ -70,8 +70,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"Errors": {
|
"Errors": {
|
||||||
"NoPerms": {
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"PageTitles": {
|
"PageTitles": {
|
||||||
|
|
Loading…
Reference in New Issue