File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 77_TRANSLATIONS = {None : gettext_module .NullTranslations ()}
88_CURRENT = local ()
99
10- _DEFAULT_LOCALE_PATH = os .path .join (os .path .dirname (__file__ ), "locale" )
10+ try :
11+ _DEFAULT_LOCALE_PATH = os .path .join (os .path .dirname (__file__ ), "locale" )
12+ except AttributeError :
13+ # in case that __file__ does not exist
14+ _DEFAULT_LOCALE_PATH = None
1115
1216
1317def get_translation ():
@@ -23,6 +27,12 @@ def activate(locale, path=None):
2327 @param path: path to search for locales"""
2428 if path is None :
2529 path = _DEFAULT_LOCALE_PATH
30+
31+ if path is None :
32+ raise Exception (
33+ "Humanize cannot determinate the default location of the 'locale' folder. "
34+ "You need to pass the path explicitly."
35+ )
2636 if locale not in _TRANSLATIONS :
2737 translation = gettext_module .translation ("humanize" , path , [locale ])
2838 _TRANSLATIONS [locale ] = translation
You can’t perform that action at this time.
0 commit comments