I build an app with following layers:
- WEB presentation layer
- Business Logic Layer – BLL – called from WEB UI through HTTP web services
- WindowsService – Runtime – called from BLL through net.pipe
BLL can also be called from 3rd party for integration into other customer’s systems.
Let’s say that there is an validation error that happens in the Runtime or even BLL. Where would be better to put translations:
- in the exception message – means that we must send UICulture from WEB layer to lower layers
- BLL and Runtime are returning error codes or custom Exception derived types and translation is performed in WEB UI layer
- some other method
What is the best practice for supporting multiple languages in SOA architectures ?
EDIT: I should probably use the term tiers instead of layers.
- WEB UI tier is implemented in ASP.NET web forms and will be deployed on server A under IIS.
- BLL and Runtime will be deployed on server B but are separated by process boundaries (BLL runs under ASP.NET worker process because of WCF services and Runtime runs as separated windows service process).
My advice for your issues is general because I do not know the specifics of the .NET platform you are working with.
From your question, I see two distinct problems.
You web presentation layer will be language-dependent. It will require custom CSS, fonts, spacing and even custom content. Do not fool yourself that this will not be needed. This is one of the biggest mistakes people make initially when internationalizing web applications. You will need another style for the language. So, if you are using a template approach you can put most of your language content right in the language-dependent template.
From the description of your problem, it sounds like you will also need to handle localized error messages. There is two approaches two this: you can have a language file where you localize when the error is thrown using a resource file solution. Another approach is to have your error messages use a common identifier and parameters and have another layer catch the message and localize it. I myself prefer the former solution since it is simpler.
Also remember that if you are writing your error messages to a log file, that the error messages are in a language that the developers can read. Likewise for errors displayed to users in the GUI, you will want some way for the users to identify the errors to the developers who do not speak the user’s language. This could be done by using numbers – I prefer using short keys like
DATABASE_ERROR_BAD_QUERY.