locked
LS HTML Web.Config Globalization ignored RRS feed

  • Question

  • Well the title is self explanatory. I set the globalization culture but the html application keeps ignoring it.

    It seems the only way to set culture is to change the browser language settings but this is not the solution I am looking for obvious reasons. The deployment is a shared Azure Website if that helps.

    Can anyone point me to the right direction?

    Thank you.


    Monday, September 16, 2013 12:34 AM

All replies

  • It seems the only way to set culture is to change the browser language settings but this is not the solution I am looking for obvious reasons.


    You will have to explain what other solution is that you want and why what we have implemented is not the obvious solution. If a client (the browser) requests information in a certain language, then the server should send back information in that language, if the language is supported.

    Justin Anderson, LightSwitch Development Team

    Monday, September 16, 2013 7:07 AM
    Moderator
  • Hi Justin.

    I will try to explain why the implemented solution is not the best option for some cases.

    First, there are occasions that a web site must show currencies in a certain format. If I create a site that sells products I want the price to be shown in the same currency no matter what settings the visitor has.

    Secondly, imagine and American with date setting 'm/d/yyyy' browsing the internet from Europe where dates are 'd/m/yyyy'. The possibility for errors is obvious.

    This are the two reasons that I have in my mind at the moment but maybe someone else could point to more from experience.

    Thank you.


    Monday, September 16, 2013 9:35 AM
  • Those two cases have nothing to do with the language a user speaks.

    The first is just a formatting consideration, where you either have a fixed format (this is what the Money type and controls handle) or you format a value based on another value in the same entity (the first value being an amount, the second being something that denotes the currency).

    The second is purely based on where the user lives. Again, it should be handled separately from spoken language. Dates in the US are MM/DD/YYYY whereas in the UK they are DD/MM/YYYY yet the primary language in both countries is English.


    Justin Anderson, LightSwitch Development Team

    Monday, September 16, 2013 9:43 AM
    Moderator
  • Sorry Justin you miss understood me.

    When I say the browser language I don't mean the language the user speaks or reads or sees in his computer. I am referring to the option Tools --> Internet Options --> Languages.

    This setting controls how locale info should be displayed and in what format.

    For first case your answer is accepted and you are right. The money control is what I needed but for the second maybe I am wrong but I want to clarify it a little bit more and if I am mistaken I apologize.

    I leave in Greece with date format 'dd/MM/yyyy'. Spoken language Greek. And I move to New York I go to an Internet Café, or I borrow a PC from someone to see what my company in Greece is doing. When I enter my application, dates will be shown as 'MM/dd/yyyy'. I speak Greek they speak English. I see a date as 1/3/2013 and you see my point.

    The problem is I am not leaving constantly at the same place and this date variations are a problem to me when I use a computer other than mine.

    Thank you


    Monday, September 16, 2013 10:04 AM
  • The way that is usually done is that the application has some form of authentication enabled and a date format is associated with a user profile. So when a person uses the application and logs in, you know who they are, you can look up the format that is stored in the database for that user, and then format dates using it. You would need to store this type of information for times and numbers as well.

    There may be some JavaScript libraries that can do this kind of conversion for you automatically if given a region or country, but I'm not sure. If not, you can roll your own solution.

    In either case, I would suggest creating a suggestion on the Visual Studio Connect site to possibly integrate this type of system out of the box. You can post a link to your suggestion here so that users can more easily find it and vote on it.


    Justin Anderson, LightSwitch Development Team

    Monday, September 16, 2013 10:14 AM
    Moderator
  • I have already used moment.js

    The last time I used a computer with browser language set to English(US) meaning date setting for the browser 'MM/dd/yyyy' moment.js outputs NaN/NaN/NaN for dates like 15/3/2013 at original format (dd/MM/yyyy).

    Thank you for your time.

    Monday, September 16, 2013 10:24 AM