From 41ee3be2cc180b182d15b050fa9d171baa2ddc6e Mon Sep 17 00:00:00 2001 From: alvinhochun Date: Thu, 11 Jul 2024 19:46:28 +0800 Subject: [PATCH] Do not add a language fallback by the stripping country code (#9635) --- CHANGES.rst | 2 ++ sphinx/locale/__init__.py | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 204df1ae5bf..ac7e8ce299a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -119,6 +119,8 @@ Bugs fixed titles tend to rank higher than subsection titles. In addition, boost matches on the name of programming domain objects relative to title/subtitle matches. Patch by James Addison and Will Lachance. +* #9634: Do not add a fallback language by stripping the country code. + Patch by Alvin Wong. Testing ------- diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index f464b4cab99..81850bfe397 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -114,11 +114,7 @@ def init( translator = None if language: - if '_' in language: - # for language having country code (like "de_AT") - languages: list[str] | None = [language, language.split('_')[0]] - else: - languages = [language] + languages: list[str] | None = [language] else: languages = None