Reputation: 215
In our webapp we log messages to the server via window.onerror
However, if the client (the web browser) is using a non english language the message will be in whatever language the user has their web browser set to.
Is there any way to change this somehow?
Currently it is very unhelpful to get messages in multiple languages, hard to search for similar errors when they are in 12 different languages, also tricky for developers that need to translate to english all the time to figure out what went wrong.
[Edit] Adding an example here
window.onerror = function (message, url, lineNumber, columnNumber) {
// log error here to server
}
In this example, the message will be in english most of the time, but sometimes it turns up in for example danish or swedish depending on the client (webbrowser).
Upvotes: 18
Views: 1933
Reputation: 810
Short answer: you cannot change it. The message is a descriptive message because of an error code. Your web app should take into consideration only the state (code) of the error, not the message.
These messages are part of your browser settings, which you will not have rights to change (some of them are read-only, but all are write-protected). This could mean I can render a user's browser useless by changing the program settings from javascript (for example, changing the language to Japanese for an english-only user :).
Upvotes: 4