Localised the not found error.

This commit is contained in:
Azareal 2018-09-27 20:53:40 +10:00
parent 59497de8dc
commit d8d5bc0573
3 changed files with 5 additions and 4 deletions

View File

@ -281,7 +281,7 @@ func SecurityError(w http.ResponseWriter, r *http.Request, user User) RouteError
// ? - Add a JSQ and JS version of this? // ? - Add a JSQ and JS version of this?
// ? - Add a user parameter? // ? - Add a user parameter?
func NotFound(w http.ResponseWriter, r *http.Request, header *Header) RouteError { func NotFound(w http.ResponseWriter, r *http.Request, header *Header) RouteError {
return CustomError("The requested page doesn't exist.", 404, "Not Found", w, r, header, GuestUser) return CustomError(GetErrorPhrase("not_found"), 404, "Not Found", w, r, header, GuestUser)
} }
// CustomError lets us make custom error types which aren't covered by the generic functions above // CustomError lets us make custom error types which aren't covered by the generic functions above

View File

@ -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(name string) (string, bool) { func GetErrorPhrase(name string) string {
res, ok := currentLangPack.Load().(*LanguagePack).Errors[name] res, ok := currentLangPack.Load().(*LanguagePack).Errors[name]
if !ok { if !ok {
return getPhrasePlaceholder("error", name), false return getPhrasePlaceholder("error", name)
} }
return res, true return res
} }
func GetNoticePhrase(name string) string { func GetNoticePhrase(name string) string {

View File

@ -70,6 +70,7 @@
}, },
"Errors": { "Errors": {
"not_found":"The requested page doesn't exist."
}, },
"PageTitles": { "PageTitles": {