Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-02-07 13:29:24 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-02-09 16:49:01 +0300
commitd25c3ad2419aa01ab0b64898ebe71bb7139928cb (patch)
tree8fd4655ec193f4bde52f75828803769d491ba734 /sphinx/locale
parent84458da82889e28fc44988601a79c0c562e0e994 (diff)
Update type annotations
Diffstat (limited to 'sphinx/locale')
-rw-r--r--sphinx/locale/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py
index bedd9e1cb..28dda2e1a 100644
--- a/sphinx/locale/__init__.py
+++ b/sphinx/locale/__init__.py
@@ -106,7 +106,7 @@ class _TranslationProxy(UserString):
translators = defaultdict(NullTranslations) # type: Dict[Tuple[str, str], NullTranslations]
-def init(locale_dirs: List[Optional[str]], language: str,
+def init(locale_dirs: List[Optional[str]], language: Optional[str],
catalog: str = 'sphinx', namespace: str = 'general') -> Tuple[NullTranslations, bool]:
"""Look for message catalogs in `locale_dirs` and *ensure* that there is at
least a NullTranslations catalog set in `translators`. If called multiple
@@ -123,9 +123,11 @@ def init(locale_dirs: List[Optional[str]], language: str,
if language and '_' in language:
# for language having country code (like "de_AT")
- languages = [language, language.split('_')[0]]
- else:
+ languages = [language, language.split('_')[0]] # type: Optional[List[str]]
+ elif language:
languages = [language]
+ else:
+ languages = None
# loading
for dir_ in locale_dirs: