'Change the format of the number depending on the language
Based on https://code.djangoproject.com/browser/django/trunk/django/utils/numberformat.py'

@staticmethod
def represent(number):

    if (number is None):
        return ''
    try:
        intnumber = int(number)
    except:
        intnumber = number
    settings = current.deployment_settings
    THOUSAND_SEPARATOR = settings.get_L10n_thousands_separator()
    NUMBER_GROUPING = settings.get_L10n_thousands_grouping()
    if (float(number) < 0):
        sign = '-'
    else:
        sign = ''
    str_number = unicode(intnumber)
    if (str_number[0] == '-'):
        str_number = str_number[1:]
    int_part_gd = ''
    for (cnt, digit) in enumerate(str_number[::(-1)]):
        if (cnt and (not (cnt % NUMBER_GROUPING))):
            int_part_gd += THOUSAND_SEPARATOR
        int_part_gd += digit
    int_part = int_part_gd[::(-1)]
    return (sign + int_part)
