siteXculture and siteXuiculture

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
8/4/2011 11:27:33 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

siteXculture and siteXuiculture

I'm not sure if this is a bug or an intentional design choice, but here's the situation:

I have a custom feature for accepting online payments. Everything works great, but I had a report from someone saying we were trying to charge him in Euros instead of US dollars. We have no forced culture set up, so I set my browser language to es-ES, thinking that a European language browser setting would be the culprit. With this set, it did show a Euro symbol instead of $, and the mojoPortal keys (Sign In, etc.) were using the Spanish translation.

So what I'd like to do is define our sites' cultures as en-US for currency/dates, but leave the site UI culture alone so that it will continue to use the browser settings for UI element translation (if available). As a test, I set up our user.config as follows:

<add key="UseCultureOverride" value="true" />
<add key="site1culture" value="en-US" />
<add key="site2culture" value="en-US" />
<add key="site3culture" value="en-US" />
...

With this setup, the currency symbol and comma/period separators are now handled correctly, but rather than using the browser's settings for UI, it seems to be using en-US for that as well (mojoPortal links are showing as English).

Thanks,

Jamie

8/4/2011 11:58:18 AM
Gravatar
Total Posts 18439

Re: siteXculture and siteXuiculture

Hi Jamie,

Currently if you force a culture it will also set the UI culture to the same culture unless you specify forcing a different culture for UI.

The way I handle this in my commerce features is to not depend on forcing any culture with those settings, but specifically get a CultureInfo object for the site currency like this:

protected CultureInfo currencyCulture;

currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

then I use that culture to format prices, like in this data binding example from the WebStore product list

<span class="price"><%# string.Format(CurrencyCulture, "{0:c}",Convert.ToDecimal(Eval("Price"))) %></span>

I will add a Web.config setting to allow disabling setting of the UI culture when setting the thread culture

<add key="SetUICultureWhenSettingCulture" value="false" />

then you would be able to make it work with your existing code. I'll leave it up to you which solution to use.

Hope that helps,

Joe

 

8/4/2011 12:15:11 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: siteXculture and siteXuiculture

Hi Joe, thanks a lot for the detailed reply! I like how your method of getting and using the currency info for the site's defined currency is clean and localized, so I'll change my code over to use that. As a bonus it won't force the dates to be US format too.

Jamie

You must sign in to post in the forums. This thread is closed to new posts.