Question

I'm developing a web service that needs to return results in both french and english. (Other languages may be added later.) The web service is written in C#.

I have separated all of the strings into a resource file. I was planning on adding a parameter to the service and setting the Thread.CurrentThread.CurrentCulture to the appropriate value. Then when I go to retrieve the correct string I check the CurrentCulture value.

Is this a good practice?

Was it helpful?

Solution

Rather than adding a parameter to every call in the service (or to whatever sort of webservice context you've got - it's a while since I've done any WS stuff), have you thought of hosting the web service under different URLs to represent the different languages?

I'm not going to claim it's a fabulous idea, but it has the benefit of being really simple :) Seriously, I'm sure there will be lots of pros and cons, but it's another thing to throw into the mix.

OTHER TIPS

This type of information goes into the soap headers. Check this link for information on how to set it up: http://geekswithblogs.net/claeyskurt/archive/2007/10/23/SoapHeadersInWCFforAMSXClients.aspx.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top