diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -6,6 +6,7 @@ # of the GNU General Public License, incorporated herein by reference. from revlog import * +from i18n import gettext as _ from demandload import demandload demandload(globals(), "os time util") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -7,6 +7,7 @@ from demandload import demandload from node import * +from i18n import gettext as _ demandload(globals(), "os re sys signal shutil imp urllib pdb") demandload(globals(), "fancyopts ui hg util lock revlog") demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -9,6 +9,7 @@ of the GNU General Public License, incor import struct, os from node import * +from i18n import gettext as _ from demandload import * demandload(globals(), "time bisect stat util re") diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -11,6 +11,7 @@ from demandload import demandload demandload(globals(), "mdiff time re socket zlib errno ui hg ConfigParser") demandload(globals(), "zipfile tempfile StringIO tarfile BaseHTTPServer util") from node import * +from i18n import gettext as _ def templatepath(): for f in "templates", "../templates": diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -7,6 +7,7 @@ from node import * from remoterepo import * +from i18n import gettext as _ from demandload import * demandload(globals(), "hg os urllib urllib2 urlparse zlib util") diff --git a/mercurial/i18n.py b/mercurial/i18n.py new file mode 100644 --- /dev/null +++ b/mercurial/i18n.py @@ -0,0 +1,12 @@ +""" +i18n.py - internationalization support for mercurial + +Copyright 2005 Matt Mackall + +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', '/usr/share/locale', fallback=1) +gettext = t.gettext diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -8,6 +8,7 @@ import struct, os, util import filelog, manifest, changelog, dirstate, repo from node import * +from i18n import gettext as _ from demandload import * demandload(globals(), "re lock transaction tempfile stat mdiff errno") diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -7,6 +7,7 @@ import sys, struct from revlog import * +from i18n import gettext as _ from demandload import * demandload(globals(), "bisect") diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -11,6 +11,7 @@ of the GNU General Public License, incor """ from node import * +from i18n import gettext as _ from demandload import demandload demandload(globals(), "binascii errno heapq mdiff sha struct zlib") diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py --- a/mercurial/sshrepo.py +++ b/mercurial/sshrepo.py @@ -7,6 +7,7 @@ from node import * from remoterepo import * +from i18n import gettext as _ from demandload import * demandload(globals(), "hg os re stat") diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -13,6 +13,7 @@ import os import util +from i18n import gettext as _ class transaction: def __init__(self, report, opener, journal, after=None): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -6,6 +6,7 @@ # of the GNU General Public License, incorporated herein by reference. import os, ConfigParser +from i18n import gettext as _ from demandload import * demandload(globals(), "re socket sys util") diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -11,6 +11,7 @@ platform-specific details from the core. """ import os, errno +from i18n import gettext as _ from demandload import * demandload(globals(), "re cStringIO shutil popen2 tempfile threading time")