From 4adccf7e03ea481070911f302701aa9661c1f614 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 14 Aug 2020 16:11:23 +0900 Subject: [PATCH] Fix #6640: i18n: Failed to override system message translation Our document describes that users can override system messages via their own message catalog named `sphinx.mo` under the locale_dirs. But it has not been used since its beginning of i18n mechanism because the priority of users' message catalog is lower than system's. This makes the priority of users' message catalog higher than system's. --- CHANGES | 1 + sphinx/application.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4c6e4e38d4c..d2e3322c10d 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ Bugs fixed ---------- * #8085: i18n: Add support for having single text domain +* #6640: i18n: Failed to override system message translation * #8093: The highlight warning has wrong location in some builders (LaTeX, singlehtml and so on) diff --git a/sphinx/application.py b/sphinx/application.py index d84a2c97513..9b8824e69ad 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -293,7 +293,7 @@ def _init_i18n(self) -> None: if catalog.domain == 'sphinx' and catalog.is_outdated(): catalog.write_mo(self.config.language) - locale_dirs = [None, path.join(package_dir, 'locale')] + list(repo.locale_dirs) + locale_dirs = [None] + list(repo.locale_dirs) + [path.join(package_dir, 'locale')] self.translator, has_translation = locale.init(locale_dirs, self.config.language) if has_translation or self.config.language == 'en': # "en" never needs to be translated