コード例 #1
0
 def test_unknown(self):
     """
     Test that when the current locale is not supported by Babel, it
     defaults to en-US.
     """
     activate('fy')
     eq_(Locale('en', 'US'), current_locale())
コード例 #2
0
ファイル: helpers.py プロジェクト: tyler46/affiliates
def babel_date(date, format='long'):
    """
    Format a date properly for the current locale. Format can be one of
    'short', 'medium', 'long', or 'full'.
    """
    locale = current_locale()
    return format_date(date, format, locale)
コード例 #3
0
def month_year_picker(request):
    """Adds localized date info for the month-year picker widget."""
    locale = current_locale()

    return {
        'mypicker_months_short': get_month_names('abbreviated', locale=locale),
        'mypicker_months_long': get_month_names('wide', locale=locale)
    }
コード例 #4
0
 def test_basic(self):
     """Test that the currently locale is correctly returned."""
     activate('fr')
     eq_(Locale('fr'), current_locale())
コード例 #5
0
ファイル: helpers.py プロジェクト: tyler46/affiliates
def babel_number(number):
    """Format a number properly for the current locale."""
    locale = current_locale()
    return format_number(number, locale)