Hi forum
I'm developing a business tier/layer for a web based UI. I would like the UI to be able to run in any culture but I'm guessing that I need to store dates and numbers one way.
My business tier can be located on another server. (via remoting).
I understand that it is the CurrentCulture on the thread that affects for formatting of dates and numbers. I would like to make it possible for both dates and numbers to be formatted when displayed in the browser - based on the browser language setting.
How do I store these numbers and dates Should the UI do some handling before sending the dates or numbers to the business tier or is it the responsability of the business tier
Should I just make sure that the thread on the business tier has the same culture as the client - By sending the Culture using thead local storage, and setting it on the business tier for each call So actually multiple cultures will be at work at the same time I store the data through stored procedures - will this just work if the business tier has the same culture
Hope someone can help me.

Localization - Numbers/dates - Responsibility of UI Tier or Business Tier?
Harish77
Hi Peter, thank you for answering my post.
I read about the option of sending numbers/dates in an invariant culture.
How would this work for me
I'm sending data-transfer-objects from by business tier to my UI (actually all the way from my data layer). Do I set a date property using some kind of formatting from the business/data tier ..and do the UI then also have to do something similar when sending it back
I'm unsure of this passing of the data between UI and Business. Is there a recommended way of implementing this
You state: Under certain circumstances this isn't necessarily possible. A good example is a presentation tier than can only deal with textual ("pre-formatted") data like web browsers or web service clients.
Are you here saying it might not be an option for me
About using the same culture in the business tier. Wouldn't it work to set the same culture on the business tier. Wouldn't having the same culture in all tiers/layers be a way fix the problem entirely ..or can the database only handle input in the culture it is running in or does ADO.NET take care of sending numbers and dates in an understandable format no matter the culture .. I'm sorry if this is a stupid question. But I'm trying to get my head around this :)
Jassim Rahma
...sent my previous message too soon... The scenarios document links to some of the other ws-i19n TRs which also may provide some useful information.
In terms of web browsers and "localization" of data, I've noticed a recent update to codeplex.com does some interesting localization of dates. Basically, all dates are given the class "smartDate". When the page loads a script is run (SmartDate_Load(), I believe) that iterates all elements with that class and converts the "LocalTimeTicks" from a known locale to the browser's locale. Quite innovative, I think. Something to think about when using browser clients...
Genetic1234
> I'm unsure of this passing of the data between UI and Business. Is there a recommended way of implementing this
There really isn't a single "right" way to pick. Browsers can send a requested-locale header to tell the server how to localize the results. But if you are sending data as XML, you should stick to XML Schema standards, which are culture-invariant, for encoding dates & numbers. I think that if you have a UI that knows which values are dates and how to format them, it's better to send the data in a culture-neutral way.
Nima_DK
Generally it's best to think of data coming in and out of the data and business logic tiers as culture invariant. This is best accomplished by passing low-level data formats (float, double, decimal for floating-point data; DateTime for dates or times; etc.). The data that arrives to the presentation layer can then be formatted appropriately.
Under certain circumstances this isn't necessarily possible. A good example is a presentation tier than can only deal with textual ("pre-formatted") data like web browsers or web service clients.
There's a good overview of general globalization rules as they apply to the web service provider web server client relationship in the ws-I19n documents, most notably the Web Services Internationalization Usage Scenarios