mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
i18n: lookup .mo files in private locale/ directory
This default is to look for /usr/share/locale/xx/LC_MESSAGES/hg.mo for language xx, but this code will instead do the lookup from locale/ or mercurial/locale/ relative to the root of the Mercurial source tree.
This commit is contained in:
parent
8a1d290eb9
commit
b8064b97f3
@ -7,7 +7,20 @@ This software may be used and distributed according to the terms
|
||||
of the GNU General Public License, incorporated herein by reference.
|
||||
"""
|
||||
|
||||
import gettext
|
||||
t = gettext.translation('hg', fallback=1)
|
||||
import gettext, sys, os
|
||||
|
||||
# modelled after templater.templatepath:
|
||||
if hasattr(sys, 'frozen'):
|
||||
module = sys.executable
|
||||
else:
|
||||
module = __file__
|
||||
|
||||
base = os.path.dirname(module)
|
||||
for dir in ('.', '..'):
|
||||
localedir = os.path.normpath(os.path.join(base, dir, 'locale'))
|
||||
if os.path.isdir(localedir):
|
||||
break
|
||||
|
||||
t = gettext.translation('hg', localedir, fallback=True)
|
||||
gettext = t.gettext
|
||||
_ = gettext
|
||||
|
Loading…
Reference in New Issue
Block a user