From 1a6731e2b51747764199da40bb39fcb9354dfe58 Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Thu, 3 Mar 2016 18:17:44 +0100 Subject: [PATCH] Only attempt a normalization search if filesystem lookup fails. --- babel/localedata.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/babel/localedata.py b/babel/localedata.py index 265e4b8f..1f437379 100644 --- a/babel/localedata.py +++ b/babel/localedata.py @@ -44,7 +44,10 @@ def exists(name): :param name: the locale identifier string """ - return True if normalize_locale(name) else False + if name in _cache: + return True + file_found = os.path.exists(os.path.join(_dirname, '%s.dat' % name)) + return True if file_found else bool(normalize_locale(name)) def locale_identifiers(): -- 2.47.2