]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Allow any properly-formatted locale, not just ones in LOCALE_NAMES.
authorBen Darnell <ben@bendarnell.com>
Sun, 10 Jul 2011 19:11:43 +0000 (12:11 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 10 Jul 2011 19:11:43 +0000 (12:11 -0700)
tornado/locale.py

index 5d8def8e85e932b53f267765cc4746a73a5c24dc..61cdb7e7eb68f662f888cf0baf70e3974b826d5e 100644 (file)
@@ -43,6 +43,7 @@ import csv
 import datetime
 import logging
 import os
+import re
 
 _default_locale = "en_US"
 _translations = {}
@@ -110,7 +111,7 @@ def load_translations(directory):
     for path in os.listdir(directory):
         if not path.endswith(".csv"): continue
         locale, extension = path.split(".")
-        if locale not in LOCALE_NAMES:
+        if not re.match("[a-z]+(_[A-Z]+)?$", locale):
             logging.error("Unrecognized locale %r (path: %s)", locale,
                           os.path.join(directory, path))
             continue