Skip to content

Commit

Permalink
gettext; look in locale-bundle location for .mo
Browse files Browse the repository at this point in the history
  • Loading branch information
nanjekyejoannah committed Oct 13, 2023
1 parent f27b830 commit 4500d20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
]

_default_localedir = os.path.join(sys.base_prefix, 'share', 'locale')
_default_localebundledir = os.path.join(sys.prefix, 'share', 'locale-bundle')

# Expression parsing for plural form selection.
#
Expand Down Expand Up @@ -477,6 +478,10 @@ def npgettext(self, context, msgid1, msgid2, n):

# Locate a .mo file using the gettext strategy
def find(domain, localedir=None, languages=None, all=False):
if localedir in [None, _default_localebundledir]:
bundle = find(domain, localedir=_default_localebundledir, languages=languages, all=all)
if len(bundle):
return bundle
# Get some reasonable defaults for arguments that were not supplied
if localedir is None:
localedir = _default_localedir
Expand Down

0 comments on commit 4500d20

Please sign in to comment.