Currency formatting is not possible using the 'C' locale.

2,589 views
Skip to first unread message

RickG

unread,
Jan 30, 2011, 11:26:23 PM1/30/11
to Mezzanine Users
A brand new Cartridge installation gives me:

TemplateSyntaxError at /
Caught ValueError while rendering: Currency formatting is not possible
using the 'C' locale.

I use Apache and mod_wsgi and found out that be default Apache sets
your locale to 'C', which is what happens when it doesn't know what
language settings you want to use. I tried setting up my wsgi scripts
as in here:

http://blog.picante.co.nz/post/Django-Apache-WSGI-locale-and-Currency-formatting-is-not-possible-using-the-C-locale/

which didn't work, nor did putting the same line in my settings.py
file. It only worked when I put it directly into Cartridge's
shop_tags.py file, putting this:

locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

right above the "value = locale.currency(value)" line.

So maybe the locale should be a variable chosen by the user when
creating a new Cartridge site, and editable from the admin view? Or
at least it should check some environment variable like LANG to find
the correct locale.



Stephen McDonald

unread,
Jan 30, 2011, 11:30:05 PM1/30/11
to mezzani...@googlegroups.com
You should be able to define the locale using the setting: SHOP_CURRENCY_LOCALE

In your case in your settings module it would be:

SHOP_CURRENCY_LOCALE = "en_US.UTF-8"

Could you revert your change and try that? I'd be keen to know if that resolves it.

Cheers,
Steve
--
Stephen McDonald

RickG

unread,
Jan 30, 2011, 11:46:52 PM1/30/11
to Mezzanine Users
Yeah, that fixes it more cleanly, using an unaltered Cartridge
package. Thanks!

On Jan 30, 11:30 pm, Stephen McDonald <stephen...@gmail.com> wrote:
> You should be able to define the locale using the
> setting: SHOP_CURRENCY_LOCALE
>
> In your case in your settings module it would be:
>
> SHOP_CURRENCY_LOCALE = "en_US.UTF-8"
>
> Could you revert your change and try that? I'd be keen to know if that
> resolves it.
>
> Cheers,
> Steve
>
>
>
>
>
>
>
>
>
> On Mon, Jan 31, 2011 at 3:26 PM, RickG <rger...@gmail.com> wrote:
> > A brand new Cartridge installation gives me:
>
> > TemplateSyntaxError at /
> > Caught ValueError while rendering: Currency formatting is not possible
> > using the 'C' locale.
>
> > I use Apache and mod_wsgi and found out that be default Apache sets
> > your locale to 'C', which is what happens when it doesn't know what
> > language settings you want to use.  I tried setting up my wsgi scripts
> > as in here:
>
> >http://blog.picante.co.nz/post/Django-Apache-WSGI-locale-and-Currency...

Stephen McDonald

unread,
Jan 30, 2011, 11:47:34 PM1/30/11
to mezzani...@googlegroups.com
Great, thanks for checking - I'd say this is a documentation issue then.

Cheers,
Steve
Reply all
Reply to author
Forward
0 new messages