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())
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)
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) }
def test_basic(self): """Test that the currently locale is correctly returned.""" activate('fr') eq_(Locale('fr'), current_locale())
def babel_number(number): """Format a number properly for the current locale.""" locale = current_locale() return format_number(number, locale)