I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no language-specific? And how can that exception later be displayed based on the current locale?
I was originally looking for a way to localize the error message at the point where it is thrown, but realized that this is not the best way because (a) it introduces an unnecessary dependency between the business model and the web framework; and (b) language should be determined by the current locale when the exception is displayed, not when it is thrown.
So I'm wondering how other people have approached this problem. (And I don't think this is really specific to Struts 2, but relevant to any multi-lingual application).