Commits

Bruce Kroeze  committed 601f1bc

converting from old python based locales to an explicit currency-by-currency-code scheme

  • Participants
  • Parent commits 9e0e7ad

Comments (0)

Files changed (14)

File satchmo/apps/l10n/config.py

-# -*- coding: utf-8 -*-
-
-from django.utils.translation import ugettext_lazy as _
-from livesettings import *
-
-LANGUAGE_GROUP = ConfigurationGroup('LANGUAGE',_('Internationalization Settings'))
-
-CURRENCY = config_register(
-    StringValue(LANGUAGE_GROUP,
-        'CURRENCY',
-        description= _("Default currency symbol"),
-        help_text= _("Use a '_' character to force a space."),
-        default="$"))
-
-ALLOW_TRANSLATIONS = config_register(
-    BooleanValue(LANGUAGE_GROUP,
-    'SHOW_TRANSLATIONS',
-    description = _('Show translations?'),
-    help_text = _("Show translations in admin."),
-    default = True))
-
-LANGUAGE_ALLOW_TRANSLATIONS = config_register(
-    BooleanValue(LANGUAGE_GROUP,
-    'ALLOW_TRANSLATION',
-    description=_("Allow user to choose from available translations"),
-    default=False,
-    ordering=1))
-
-LANGUAGES_AVAILABLE = config_register(
-    MultipleStringValue(LANGUAGE_GROUP,
-    'LANGUAGES_AVAILABLE',
-    requires = LANGUAGE_ALLOW_TRANSLATIONS,
-    description = _("Available languages"),
-    help_text=_("Languages that have valid translations"),
-    choices=[('en', "English"),
-            ('fr', "Français"),
-            ('de',"Deutsch"),
-            ('es', "Español"),
-            ('he',"עִבְרִית"),
-            ('it',"Italiano"),
-            ('ko', "한국어"),
-            ('sv', "Svenska"),
-            ('pt-br',"Português"),
-            ('bg',"Български"),
-            ('tr',"Türkçe")]
-    ))
-

File satchmo/apps/l10n/l10n_settings.py

+# -*- coding: UTF-8 -*-
+"""A central mechanism forsettings which have defaults.
+
+Repurposed from Sphene Community Tools: http://sct.sphene.net
+"""
+
+from django.conf import settings
+import logging
+log = logging.getLogger('l10n.l10n_settings')
+
+l10n_settings_defaults = {
+    # (or global settings) -- all other defaults should be added using
+    # the add_setting_defaults method !
+
+    'currency_formats' : {
+        'USD' : {'symbol': '$', 'positive' : "$%(val)0.2f", 'negative': "-$%(val)0.2f", 'decimal' : '.'},
+        'GBP' : {'symbol': '£', 'positive' : "£%(val)0.2f", 'negative': "-£%(val)0.2f", 'decimal' : '.'},
+    },
+    
+    'default_currency' : 'USD'
+}
+
+
+def add_setting_defaults(newdefaults):
+    """
+    This method can be used by other applications to define their
+    default values.
+    
+    newdefaults has to be a dictionary containing name -> value of
+    the settings.
+    """
+    l10n_settings_defaults.update(newdefaults)
+
+
+def set_l10n_setting(name, value):
+    if not hasattr(settings, 'L10N_SETTINGS'):
+        settings.L10N_SETTINGS = {}
+    settings.L10N_SETTINGS[name] = value
+    
+
+def get_l10n_setting(name, default_value = None):
+    if not hasattr(settings, 'L10N_SETTINGS'):
+        return l10n_settings_defaults.get(name, default_value)
+
+    return settings.L10N_SETTINGS.get(name, l10n_settings_defaults.get(name, default_value))
+
+def get_l10n_default_currency_symbol():
+    key = get_l10n_setting('default_currency', default_value='USD')
+    try:
+        return get_l10n_setting('currency_formats')[key]['symbol']
+    except KeyError:
+        log.warn('could not find default currency symbol, please make sure you have a L10N_SETTINGS in your settings file, and that it has a default currency.')
+        return "$"

File satchmo/apps/l10n/models.py

 
     def __unicode__(self):
         return self.name
-
-import config

File satchmo/apps/l10n/tests.py

+# -*- coding: UTF-8 -*-
 from django.test import TestCase
 from l10n.validators import aupostcode, capostcode, uspostcode
+from l10n import l10n_settings
+from l10n.utils import moneyfmt
+from decimal import Decimal
 
 class AUPostCodeTest(TestCase):
     def test_valid(self):
             self.fail('Invalid ZIP code "no" not caught')
         except:
             pass
+            
+class MoneyFmtTest(TestCase):
+    
+    def testUSD(self):
+        l10n_settings.set_l10n_setting('default_currency', 'USD')
+        
+        val = Decimal('10.00')
+        self.assertEqual(moneyfmt(val), '$10.00')
+
+        self.assertEqual(moneyfmt(val, currency_code='USD'), '$10.00')
+
+
+    def testGBP(self):
+        l10n_settings.set_l10n_setting('default_currency', 'GBP')
+
+        val = Decimal('10.00')
+        self.assertEqual(moneyfmt(val), '£10.00')
+
+        self.assertEqual(moneyfmt(val, currency_code='GBP'), '£10.00')
+        self.assertEqual(moneyfmt(val, currency_code='USD'), '$10.00')
+        
+        val = Decimal('-100.00')
+        self.assertEqual(moneyfmt(val), '-£100.00')
+
+    def testFake(self):
+        currencies = l10n_settings.get_l10n_setting('currency_formats')
+        currencies['FAKE'] = {'symbol': '^ ', 'positive' : "%(val)0.2f ^", 'negative': "(%(val)0.2f) ^", 'decimal' : ','}
+        
+        l10n_settings.set_l10n_setting('currency_formats', currencies)
+        
+        val = Decimal('10.00')
+        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '10,00 ^')
+
+        val = Decimal('-50.00')
+        self.assertEqual(moneyfmt(val, currency_code='FAKE'), '(50,00) ^')
+
+
+        
+        

File satchmo/apps/l10n/utils.py

+from django.core.exceptions import ImproperlyConfigured
 from django.conf import settings
-from django.core.exceptions import ImproperlyConfigured
 from django.utils.translation import get_language, to_locale
-from livesettings import config_value
-from satchmo_utils.numbers import trunc_decimal
-import locale
+from l10n.l10n_settings import get_l10n_setting
 import logging
 
 log = logging.getLogger('l10n.utils')
 
-def get_locale_conv(loc=None, tried=[], possibles=[]):
-    if loc is None:
-        loc = to_locale(get_language())
+def moneyfmt(val, currency_code=None, wrapcents=''):
+    """Formats val according to the currency settings for the desired currency, as set in L10N_SETTINGS"""
+    if val is None or val == '':
+       val = Decimal('0')
+       
+    currencies = get_l10n_setting('currency_formats')
+    currency = None
+    
+    if currency_code:
+        currency = currencies.get(currency_code, None)
+        if not currency:
+            log.warn('Could not find currency code definitions for "%s", please look at l10n.l10n_settings for examples.')
+    
+    if not currency:
+        default_currency_code = get_l10n_setting('default_currency', None)
 
+        if not default_currency_code:
+            log.fatal("No default currency code set in L10N_SETTINGS")
+            raise ImproperlyConfigured("No default currency code set in L10N_SETTINGS")
+
+        if currency_code == default_currency_code:
+            raise ImproperlyConfigured("Default currency code '%s' not found in currency_formats in L10N_SETTINGS", currency_code)
+        
+        return moneyfmt(val, currency_code=default_currency_code, wrapcents=wrapcents)
+    
+    # here we are assured we have a currency format
+    
+    if val>=0:
+        key = 'positive'
     else:
-        if loc.find('-') > -1:
-            loc = to_locale(loc)
-
-    if not possibles:
-        possibles = [(loc, 'utf-8'), loc]
-        pos = loc.find('_')
-        if pos > -1:
-            possibles.append((loc[:pos], 'utf-8'))
-            possibles.append(loc[:pos])
-        loc = to_locale(settings.LANGUAGE_CODE)
-        possibles.append((loc, 'utf-8'))
-        possibles.append(loc)
-
-    loc = None
-    for possible in possibles:
-        if not possible in tried:
-            loc = possible
-            break
-
-    if loc:
-        try:
-            log.debug('setting locale: %s', str(loc).encode('utf-8'))
-            locale.setlocale(locale.LC_ALL, loc)
-            return locale.localeconv()
-
-        except (locale.Error, ValueError):
-            tried.append(loc)
-            return get_locale_conv(loc=loc[0], tried=tried, possibles=possibles)
-
-    locs = ", ".join([str(x).encode('utf-8') for x in tried])
-    log.fatal(u"Cannot set locale to any of these locales [%s]. Something is misconfigured.", locs)
-    raise ImproperlyConfigured("bad locale")
-
-
-#backport from python2.5
-### Number formatting APIs
-
-# Author: Martin von Loewis
-# improved by Georg Brandl
-
-#perform the grouping from right to left
-def _group(s, conv, monetary=False):
-    thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
-    grouping = conv[monetary and 'mon_grouping' or 'grouping']
-    if not grouping:
-        return (s, 0)
-    result = ""
-    seps = 0
-    spaces = ""
-    if s[-1] == ' ':
-        sp = s.find(' ')
-        spaces = s[sp:]
-        s = s[:sp]
-    while s and grouping:
-        # if grouping is -1, we are done
-        if grouping[0] == locale.CHAR_MAX:
-            break
-        # 0: re-use last group ad infinitum
-        elif grouping[0] != 0:
-            #process last group
-            group = grouping[0]
-            grouping = grouping[1:]
-        if result:
-            result = s[-group:] + thousands_sep + result
-            seps += 1
-        else:
-            result = s[-group:]
-        s = s[:-group]
-        if s and s[-1] not in "0123456789":
-            # the leading string is only spaces and signs
-            return s + result + spaces, seps
-    if not result:
-        return s + spaces, seps
-    if s:
-        result = s + thousands_sep + result
-        seps += 1
-    return result + spaces, seps
-
-#backport from python2.5
-def format(percent, value, loc_conv, grouping=False, monetary=False, *additional):
-    """Returns the locale-aware substitution of a %? specifier
-    (percent).
-
-    additional is for format strings which contain one or more
-    '*' modifiers."""
-    # this is only for one-percent-specifier strings and this should be checked
-    if percent[0] != '%':
-        raise ValueError("format() must be given exactly one %char "
-                         "format specifier")
-    if additional:
-        formatted = percent % ((value,) + additional)
-    else:
-        formatted = percent % value
-    # floats and decimal ints need special action!
-    if percent[-1] in 'eEfFgG':
-        seps = 0
-        parts = formatted.split('.')
-        if grouping:
-            parts[0], seps = _group(parts[0], loc_conv, monetary=monetary)
-        decimal_point = loc_conv[monetary and 'mon_decimal_point'
-                                              or 'decimal_point']
-        formatted = decimal_point.join(parts)
-        while seps:
-            sp = formatted.find(' ')
-            if sp == -1: break
-            formatted = formatted[:sp] + formatted[sp+1:]
-            seps -= 1
-    elif percent[-1] in 'diu':
-        if grouping:
-            formatted = _group(formatted, monetary=monetary)[0]
-    return formatted
-               
-def moneyfmt(val, curr=None, places=-1, grouping=True, wrapcents='', current_locale=None):
-    """Formats val according to the currency settings in the current locale.
-    Ported-and-modified from Python 2.5
-    """
-    if val is None or val == '':
-       return val
-    conv = get_locale_conv(current_locale)
-
-    if places < 0:
-        places = conv['int_frac_digits']
+        val = abs(val)
+        key = 'negative'
+        
+    fmt = currency[key]
+    formatted = fmt % { 'val' : val }
     
-    val = trunc_decimal(val, places)
-        
-    try:    # Required because Python < 2.5 does not have monetary arg
-        s = format('%%.%if' % places, abs(val), conv, grouping, monetary=True)
-    except TypeError:
-        s = format('%%.%if' % places, abs(val), conv, grouping)
-    # '<' and '>' are markers if the sign must be inserted between symbol and value
-    s = '<' + s.decode('utf8') + '>'
-
-    if curr is None:
-        curr = config_value('LANGUAGE','CURRENCY')
-        curr = curr.replace("_", " ")
-    precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
-    separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
-
-    if precedes:
-        s = curr + (separated and ' ' or '') + s
-    else:
-        s = s + (separated and ' ' or '') + curr
-
-    sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
-    sign = conv[val<0 and 'negative_sign' or 'positive_sign']
-
-    if sign_pos == 0:
-        s = '(' + s + ')'
-    elif sign_pos == 1:
-        s = sign + s
-    elif sign_pos == 2:
-        s = s + sign
-    elif sign_pos == 3:
-        s = s.replace('<', sign)
-    elif sign_pos == 4:
-        s = s.replace('>', sign)
-    else:
-        # the default if nothing specified;
-        # this should be the most fitting sign position
-        s = sign + s
-
-    val = s.replace('<', '').replace('>', '')
+    sep = currency.get('decimal', '.')
+    if sep != '.':
+        formatted = formatted.replace('.', sep)
 
     if wrapcents:
-        pos = s.rfind(conv['decimal_point'])
+        pos = formatted.rfind(sep)
         if pos>-1:
             pos +=1 
-            val = u"%s<%s>%s</%s>" % val[:pos], wrapcents, val[pos:], wrapcents
+            formatted = u"%s<%s>%s</%s>" % formatted[:pos], wrapcents, formatted[pos:], wrapcents
 
-    return val
+    return formatted

File satchmo/apps/product/admin.py

 from django.contrib import admin
 from django.forms import models, ValidationError
 from django.utils.translation import get_language, ugettext_lazy as _
+from l10n.l10n_settings import get_l10n_setting
 from livesettings import config_value
 from product.models import Category, CategoryTranslation, CategoryImage, CategoryImageTranslation, \
                                    OptionGroup, OptionGroupTranslation, Option, OptionTranslation, Product, \
     list_display_links = ('name',)
     ordering = ['site', 'parent__id', 'ordering', 'name']
     inlines = [CategoryImage_Inline]
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(CategoryTranslation_Inline)
     filter_horizontal = ('related_categories',)
     form = CategoryAdminForm
 
 class OptionGroupOptions(admin.ModelAdmin):
     inlines = [Option_Inline]
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(OptionGroupTranslation_Inline)
     if config_value('SHOP','SHOW_SITE'):
         list_display = ('site',)
 
 class OptionOptions(admin.ModelAdmin):
     inlines = []
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(OptionTranslation_Inline)
 
 class ProductOptions(admin.ModelAdmin):
             (_('Related Products'), {'fields':('related_items','also_purchased'),'classes':('collapse',)}), )
     search_fields = ['slug', 'sku', 'name']
     inlines = [ProductAttribute_Inline, Price_Inline, ProductImage_Inline]
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(ProductTranslation_Inline)
     filter_horizontal = ('category',)
     
 
 class CustomTextFieldOptions(admin.ModelAdmin):
     inlines = []
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(CustomTextFieldTranslation_Inline)
 
 class SubscriptionProductOptions(admin.ModelAdmin):
 
 class ProductImageOptions(admin.ModelAdmin):
     inlines = []
-    if config_value('LANGUAGE','SHOW_TRANSLATIONS'):
+    if get_l10n_setting('show_translations'):
         inlines.append(ProductImageTranslation_Inline)
 
 admin.site.register(Category, CategoryOptions)

File satchmo/apps/product/utils.py

 
     details = {'SALE' : use_discount}
     
-    curr = config_value('LANGUAGE','CURRENCY')
-    curr = curr.replace("_", " ")
-
     variations = ProductPriceLookup.objects.filter(parentid=product.id).order_by("-price")
     if variations.count() == 0:
         if create:
         
         price = detl.dynamic_price
         
-        detail['PRICE'][qtykey] = moneyfmt(price, curr=curr)
+        detail['PRICE'][qtykey] = moneyfmt(price)
         if use_discount:
-            detail['SALE'][qtykey] = moneyfmt(calc_discounted_by_percentage(price, discount.percentage), curr=curr)
+            detail['SALE'][qtykey] = moneyfmt(calc_discounted_by_percentage(price, discount.percentage))
         
         if include_tax:
             tax_price = taxer.by_price(tax_class, price) + price
             detail['TAXED'][qtykey] = moneyfmt(tax_price, curr=curr)
             if use_discount:
-                detail['TAXED_SALE'][qtykey] = moneyfmt(calc_discounted_by_percentage(tax_price, discount.percentage), curr=curr)
+                detail['TAXED_SALE'][qtykey] = moneyfmt(calc_discounted_by_percentage(tax_price, discount.percentage))
                 
     return details
     

File satchmo/apps/satchmo_store/shop/models.py

 from django.utils.translation import ugettext, ugettext_lazy as _
 from l10n.models import Country
 from l10n.utils import moneyfmt
-from livesettings import ConfigurationSettings, config_value, config_choice_values
+from livesettings import ConfigurationSettings
 from payment.fields import PaymentChoiceCharField
 from product.models import Discount, Product, DownloadableProduct, PriceAdjustmentCalc, PriceAdjustment, Price, get_product_quantity_adjustments
 from satchmo_store.contact.models import Contact
     has_details = property(_has_details)
 
     def __unicode__(self):
-        currency = config_value('LANGUAGE','CURRENCY')
-        currency = currency.replace("_", " ")
-        return u'%s - %s %s%s' % (self.quantity, self.product.name,
-            force_unicode(currency), self.line_total)
+        money_format = force_unicode(moneyfmt(self.line_total))
+        return u'%s - %s %s' % (self.quantity, self.product.name,
+            money_format)
 
     class Meta:
         verbose_name = _("Cart Item")

File satchmo/apps/satchmo_store/shop/satchmo_settings.py

     'CUSTOM_TAX_MODULES' : [],
     'ALLOW_PRODUCT_TRANSLATIONS' : True,
     'COOKIE_MAX_SECONDS' : 60*60*24*30, #one month
+    'SHOW_TRANSLATIONS' : True, # show transaltions in admin
+    'ALLOW_TRANSLATIONS' : True # show available languages to users
     }
 
 

File satchmo/apps/satchmo_store/shop/templatetags/satchmo_currency.py

     except InvalidOperation:
         log.error("Could not convert value '%s' to decimal", value)
         raise
-        
-    if not 'places' in kwargs:
-        kwargs['places'] = 2
-        
+
     return mark_safe(moneyfmt(value, **kwargs))
 
 register.filter('currency', currency)

File satchmo/apps/satchmo_store/shop/templatetags/satchmo_util.py

 from django.conf import settings
 from django.core import urlresolvers
 from django.utils.safestring import mark_safe
+from l10n.l10n_settings import get_l10n_setting
 from livesettings import config_value, config_choice_values
 from product.models import Category
 from satchmo_utils.numbers import trunc_decimal
 from satchmo_utils.json import json_encode
+from threaded_multihost import threadlocals
 import logging
 import math
 
     """
     Display the set language form, if enabled in shop settings.
     """
-    request = context['request']
-    enabled = config_value('LANGUAGE', 'ALLOW_TRANSLATION')
+    request = threadlocals.get_current_request()
+    enabled = get_l10n_setting('allow_translations')
     languages = []
     if enabled:
         try:
             url = urlresolvers.reverse('satchmo_set_language')
-            languages = config_choice_values('LANGUAGE', 'LANGUAGES_AVAILABLE')
+            languages = settings.LANGUAGES
             
         except urlresolvers.NoReverseMatch:
             url = ""

File satchmo/apps/satchmo_store/shop/tests.py

 from django.utils.encoding import smart_str
 from django.utils.translation import ugettext as _
 from keyedcache import cache_delete
+from l10n.l10n_settings import get_l10n_setting
 from l10n.models import Country
+from l10n.utils import moneyfmt
 from livesettings import config_get, config_value
 from product.models import Product
 from product.utils import rebuild_pricing
         # that variation already selected
         response = self.client.get(prefix+'/product/neat-book-soft/')
         self.assertContains(response, 'option value="soft" selected="selected"')
-        self.assertContains(response, smart_str("%s5.00" % config_value('LANGUAGE','CURRENCY')))
+        amount = moneyfmt(Decimal('5.00'))
+        self.assertContains(response, smart_str(amount))
 
     def test_orphaned_product(self):
         """
         self.assertRedirects(response, url('DUMMY_satchmo_checkout-step3'),
             status_code=302, target_status_code=200)
         response = self.client.get(url('DUMMY_satchmo_checkout-step3'))
-        self.assertContains(response, smart_str("Shipping + %s4.00" % config_value('LANGUAGE','CURRENCY')), count=1, status_code=200)
-        self.assertContains(response, smart_str("Tax + %s4.60" % config_value('LANGUAGE','CURRENCY')), count=1, status_code=200)
-        self.assertContains(response, smart_str("Total = %s54.60" % config_value('LANGUAGE','CURRENCY')), count=1, status_code=200)
+        amount = smart_str('Shipping + ' + moneyfmt(Decimal('4.00')))
+        self.assertContains(response, amount, count=1, status_code=200)
+        
+        amount = smart_str('Tax + ' + moneyfmt(Decimal('4.60')))
+        self.assertContains(response, amount, count=1, status_code=200)
+        
+        amount = smart_str('Total = ' + moneyfmt(Decimal('54.60')))
+        self.assertContains(response, amount, count=1, status_code=200)
+        
         response = self.client.post(url('DUMMY_satchmo_checkout-step3'), {'process' : 'True'})
         self.assertRedirects(response, url('DUMMY_satchmo_checkout-success'),
             status_code=302, target_status_code=200)
             status_code=302, target_status_code=200)
         response = self.client.get(prefix+'/cart/')
         self.assertContains(response, '/satchmo-computer/">satchmo computer', count=1, status_code=200)
-        self.assertContains(response, smart_str("%s168.00" % config_value('LANGUAGE','CURRENCY')), count=3)
-        self.assertContains(response, smart_str("Monogram: CBM  %s10.00" % config_value('LANGUAGE','CURRENCY')), count=1)
-        self.assertContains(response, smart_str("Case - External Case: Mid  %s10.00" % config_value('LANGUAGE','CURRENCY')), count=1)
-        self.assertContains(response, smart_str("Memory - Internal RAM: 1.5 GB  %s25.00" % config_value('LANGUAGE','CURRENCY')), count=1)
+        amount = smart_str(moneyfmt(Decimal('168.00')))
+        self.assertContains(response, amount, count=3)
+        
+        amount = smart_str('Monogram: CBM  ' + moneyfmt(Decimal('10.00')))
+        self.assertContains(response, amount, count=1)
+        
+        amount = smart_str('Case - External Case: Mid  ' + moneyfmt(Decimal('10.00')))
+        self.assertContains(response, amount, count=1)
+        
+        amount = smart_str('Memory - Internal RAM: 1.5 GB  ' + moneyfmt(Decimal('25.00')))
+        self.assertContains(response, amount, count=1)
+        
         response = self.client.post(url('satchmo_checkout-step1'), get_step1_post_data(self.US))
         self.assertRedirects(response, url('DUMMY_satchmo_checkout-step2'),
             status_code=302, target_status_code=200)
         self.assertRedirects(response, url('DUMMY_satchmo_checkout-step3'),
             status_code=302, target_status_code=200)
         response = self.client.get(url('DUMMY_satchmo_checkout-step3'))
-        self.assertContains(response, smart_str("satchmo computer - %s168.00" % config_value('LANGUAGE','CURRENCY')), count=1, status_code=200)
+        
+        amount = smart_str('satchmo computer - ' + moneyfmt(Decimal('168.00')))
+        self.assertContains(response, amount, count=1, status_code=200)
         response = self.client.post(url('DUMMY_satchmo_checkout-step3'), {'process' : 'True'})
         self.assertRedirects(response, url('DUMMY_satchmo_checkout-success'),
             status_code=302, target_status_code=200)

File satchmo/apps/satchmo_utils/widgets.py

 from django import forms
 from django.utils.safestring import mark_safe
 from django.utils.translation import ugettext_lazy as _
+from l10n.l10n_settings import get_l10n_default_currency_symbol
 from livesettings import config_value
 from satchmo_utils.numbers import round_decimal
 import logging
         if value != '':
             value = _render_decimal(value, places=8)
         rendered = super(CurrencyWidget, self).render(name, value, attrs)
-        curr = config_value('LANGUAGE','CURRENCY')
+        curr = get_l10n_default_currency_symbol()
         curr = curr.replace("_", "&nbsp;")
         return mark_safe('<span class="currency">%s</span>%s' % (curr, rendered))
 

File satchmo/projects/simple/settings.py

 #    'INTERCEPT_REDIRECTS' : False,
 #}
 
+L10N_SETTINGS = {
+}
+
 #### Satchmo unique variables ####
 #from django.conf.urls.defaults import patterns, include
 SATCHMO_SETTINGS = {