How do I make my application always use English when displaying win32/.net exceptions messages?
I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Programmet kunde inte starta eftersom programmets sida-vid-sidakonfiguration är felaktig."
Extremely unhelpful, and Google had a whopping 4 hits for it, none of them helpful. So I have to guess what the original message was and google that. (It's was: "The application has failed to start because its side-by-side configuration is incorrect.")
This time it was fairly simple to find out what the original error message was, having the message in English from the start would of course save me time.
So how do I do that?
Depends on the app. A highly technical application that will be used by people that understand English and the target language, you might be OK with English error messages. If it's a message that will be seen by the end user, it should be translated.
Use grammatically correct error messagesWrite clear sentences and include ending punctuation. Each sentence in the string assigned to the Exception. Message property should end in a period. For example, "The log table has overflowed." would be an appropriate message string.
You can try setting Thread.CurrentThread.CurrentUICulture
and/or .CurrentCulture
to CultureInfo("en-US")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With