2

In exception handling, in a multi-language app, is it bad to store English in the code (strings in classes)? Is it better to use just error codes and document these? I saw a best practise somewhere that your code should not have strings which are exception messages etc (although perhaps they can be refactored out and converted to other languages at will).

Thanks

2 Answers 2

3

Why don't you place urls instead of error codes. This could be in the form of: http://myapp.com/help/error/434hb4b3.html&language=english

This way you are free to:

  1. Modify the help on the error message later without having to update the software
  2. Easily add languages
  3. Make the help for this error message a wiki so the users can modify the page and include workarounds etc.
1
  • 1
    A variant of this would be to remove "language=english" from the URL and just have the error page use the locale to determine language
    – DwB
    Dec 2, 2010 at 22:07
0

You don't mention the language/framework you are developing in, however...

Another solution would be to put your error descriptions into localised resource files. This way everything ships together and customer not have to have an internet connection access error details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.