Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Make Babel fall back to nl for fy-NL. Bug 596981.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Wenzel authored and Ryan Snyder committed Sep 21, 2010
1 parent 1dbf74e commit 9f9d7ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions apps/input/helpers.py
Expand Up @@ -8,7 +8,7 @@
from django.utils.encoding import smart_str
from django.utils.http import urlencode

from babel import Locale
from babel import Locale, UnknownLocaleError
from babel.dates import format_datetime
from babel.support import Format
from jingo import register
Expand All @@ -27,7 +27,11 @@

def _get_format():
lang = translation.get_language()
locale = Locale(translation.to_locale(lang))
try:
locale = Locale(translation.to_locale(lang))
except UnknownLocaleError:
locale = Locale(translation.to_locale(settings.BABEL_FALLBACK.get(
lang, 'en-US')))
return Format(locale)


Expand Down
7 changes: 4 additions & 3 deletions settings.py
Expand Up @@ -68,12 +68,13 @@
USE_L10N = True

# Accepted locales
# ar, he: bug 580573
INPUT_LANGUAGES = ('ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en-US', 'es',
'fr', 'gl', 'he', 'hu', 'id', 'it', 'ko', 'nb-NO', 'nl',
'pl', 'pt-PT', 'ru', 'sk', 'sq', 'uk', 'vi', 'zh-CN',
'fr', 'fy-NL', 'gl', 'he', 'hu', 'id', 'it', 'ko', 'nb-NO',
'nl', 'pl', 'pt-PT', 'ru', 'sk', 'sq', 'uk', 'vi', 'zh-CN',
'zh-TW')
RTL_LANGUAGES = ('ar', 'he',) # ('fa', 'fa-IR')
# Fallbacks for locales that are not recognized by Babel. Bug 596981.
BABEL_FALLBACK = {'fy-nl': 'nl'}


# Override Django's built-in with our native names
Expand Down

0 comments on commit 9f9d7ab

Please sign in to comment.