changeset 1402:9d2c2e6b32b5

i18n part2: use '_' for all strings who are part of the user interface
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 18 Oct 2005 18:38:39 -0700
parents fbf2b10011aa
children bc3e66edb04c
files mercurial/changelog.py mercurial/commands.py mercurial/dirstate.py mercurial/hgweb.py mercurial/httprepo.py mercurial/localrepo.py mercurial/manifest.py mercurial/revlog.py mercurial/sshrepo.py mercurial/transaction.py mercurial/ui.py mercurial/util.py
diffstat 12 files changed, 485 insertions(+), 485 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/changelog.py	Tue Oct 18 18:38:39 2005 -0700
@@ -44,11 +44,11 @@
             try:
                 when, offset = map(int, date.split(' '))
             except ValueError:
-                raise ValueError('invalid date: %r' % date)
+                raise ValueError(_('invalid date: %r') % date)
             if abs(when) > 0x7fffffff:
-                raise ValueError('date exceeds 32 bits: %d' % when)
+                raise ValueError(_('date exceeds 32 bits: %d') % when)
             if abs(offset) >= 43200:
-                raise ValueError('impossible time zone offset: %d' % offset)
+                raise ValueError(_('impossible time zone offset: %d') % offset)
         else:
             date = "%d %d" % util.makedate()
         list.sort()
--- a/mercurial/commands.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/commands.py	Tue Oct 18 18:38:39 2005 -0700
@@ -179,7 +179,7 @@
                 try:
                     num = revlog.rev(revlog.lookup(val))
                 except KeyError:
-                    raise util.Abort('invalid revision identifier %s', val)
+                    raise util.Abort(_('invalid revision identifier %s'), val)
         return num
     seen = {}
     for spec in revs:
@@ -239,7 +239,7 @@
             i += 1
         return ''.join(newname)
     except KeyError, inst:
-        raise util.Abort("invalid format spec '%%%s' in output file name",
+        raise util.Abort(_("invalid format spec '%%%s' in output file name"),
                     inst.args[0])
 
 def make_file(repo, r, pat, node=None,
@@ -333,52 +333,52 @@
         parents = []
 
     if ui.verbose:
-        ui.write("changeset:   %d:%s\n" % (rev, hex(changenode)))
+        ui.write(_("changeset:   %d:%s\n") % (rev, hex(changenode)))
     else:
-        ui.write("changeset:   %d:%s\n" % (rev, short(changenode)))
+        ui.write(_("changeset:   %d:%s\n") % (rev, short(changenode)))
 
     for tag in repo.nodetags(changenode):
-        ui.status("tag:         %s\n" % tag)
+        ui.status(_("tag:         %s\n") % tag)
     for parent in parents:
-        ui.write("parent:      %d:%s\n" % parent)
+        ui.write(_("parent:      %d:%s\n") % parent)
 
     if brinfo and changenode in brinfo:
         br = brinfo[changenode]
-        ui.write("branch:      %s\n" % " ".join(br))
+        ui.write(_("branch:      %s\n") % " ".join(br))
 
-    ui.debug("manifest:    %d:%s\n" % (repo.manifest.rev(changes[0]),
+    ui.debug(_("manifest:    %d:%s\n") % (repo.manifest.rev(changes[0]),
                                       hex(changes[0])))
-    ui.status("user:        %s\n" % changes[1])
-    ui.status("date:        %s\n" % date)
+    ui.status(_("user:        %s\n") % changes[1])
+    ui.status(_("date:        %s\n") % date)
 
     if ui.debugflag:
         files = repo.changes(log.parents(changenode)[0], changenode)
-        for key, value in zip(["files:", "files+:", "files-:"], files):
+        for key, value in zip([_("files:"), _("files+:"), _("files-:")], files):
             if value:
                 ui.note("%-12s %s\n" % (key, " ".join(value)))
     else:
-        ui.note("files:       %s\n" % " ".join(changes[3]))
+        ui.note(_("files:       %s\n") % " ".join(changes[3]))
 
     description = changes[4].strip()
     if description:
         if ui.verbose:
-            ui.status("description:\n")
+            ui.status(_("description:\n"))
             ui.status(description)
             ui.status("\n\n")
         else:
-            ui.status("summary:     %s\n" % description.splitlines()[0])
+            ui.status(_("summary:     %s\n") % description.splitlines()[0])
     ui.status("\n")
 
 def show_version(ui):
     """output version and copyright information"""
-    ui.write("Mercurial Distributed SCM (version %s)\n"
+    ui.write(_("Mercurial Distributed SCM (version %s)\n")
              % version.get_version())
-    ui.status(
+    ui.status(_(
         "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n"
         "This is free software; see the source for copying conditions. "
         "There is NO\nwarranty; "
         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
-    )
+    ))
 
 def help_(ui, cmd=None, with_version=False):
     """show help for a given command or all commands"""
@@ -401,7 +401,7 @@
             # aliases
             aliases = ', '.join(key.split('|')[1:])
             if aliases:
-                ui.write("\naliases: %s\n" % aliases)
+                ui.write(_("\naliases: %s\n") % aliases)
 
             # options
             if i[1]:
@@ -412,18 +412,18 @@
         if ui.verbose or with_version:
             show_version(ui)
         else:
-            ui.status("Mercurial Distributed SCM\n")
+            ui.status(_("Mercurial Distributed SCM\n"))
         ui.status('\n')
 
         # list of commands
         if cmd == "shortlist":
-            ui.status('basic commands (use "hg help" '
-                      'for the full list or option "-v" for details):\n\n')
+            ui.status(_('basic commands (use "hg help" '
+                        'for the full list or option "-v" for details):\n\n'))
         elif ui.verbose:
-            ui.status('list of commands:\n\n')
+            ui.status(_('list of commands:\n\n'))
         else:
-            ui.status('list of commands (use "hg help -v" '
-                      'to show aliases and global options):\n\n')
+            ui.status(_('list of commands (use "hg help -v" '
+                        'to show aliases and global options):\n\n'))
 
         h = {}
         cmds = {}
@@ -462,7 +462,7 @@
             opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
                                           longopt and " --%s" % longopt),
                                "%s%s" % (desc,
-                                         default and " (default: %s)" % default
+                                         default and _(" (default: %s)") % default
                                          or "")))
 
     if opt_output:
@@ -480,10 +480,10 @@
     names = []
     for src, abs, rel, exact in walk(repo, pats, opts):
         if exact:
-            if ui.verbose: ui.status('adding %s\n' % rel)
+            if ui.verbose: ui.status(_('adding %s\n') % rel)
             names.append(abs)
         elif repo.dirstate.state(abs) == '?':
-            ui.status('adding %s\n' % rel)
+            ui.status(_('adding %s\n') % rel)
             names.append(abs)
     repo.add(names)
 
@@ -494,11 +494,11 @@
         if src == 'f' and repo.dirstate.state(abs) == '?':
             add.append(abs)
             if ui.verbose or not exact:
-                ui.status('adding ', rel, '\n')
+                ui.status(_('adding %s\n') % rel)
         if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
             remove.append(abs)
             if ui.verbose or not exact:
-                ui.status('removing ', rel, '\n')
+                ui.status(_('removing %s\n') % rel)
     repo.add(add)
     repo.remove(remove)
 
@@ -513,7 +513,7 @@
         return trimuser(ui, cl[1], rev, ucache)
 
     if not pats:
-        raise util.Abort('at least one file name or pattern required')
+        raise util.Abort(_('at least one file name or pattern required'))
 
     opmap = [['user', getname], ['number', str], ['changeset', getnode]]
     if not opts['user'] and not opts['changeset']:
@@ -528,12 +528,12 @@
 
     for src, abs, rel, exact in walk(repo, pats, opts):
         if abs not in mmap:
-            ui.warn("warning: %s is not in the repository!\n" % rel)
+            ui.warn(_("warning: %s is not in the repository!\n") % rel)
             continue
 
         f = repo.file(abs)
         if not opts['text'] and util.binary(f.read(mmap[abs])):
-            ui.write("%s: binary file\n" % rel)
+            ui.write(_("%s: binary file\n") % rel)
             continue
 
         lines = f.annotate(mmap[abs])
@@ -586,7 +586,7 @@
                 try:
                     n = r.lookup(rev)
                 except KeyError, inst:
-                    raise util.Abort('cannot find file %s in rev %s', rel, rev)
+                    raise util.Abort(_('cannot find file %s in rev %s'), rel, rev)
         else:
             n = r.tip()
         fp = make_file(repo, r, opts['output'], node=n, pathname=abs)
@@ -598,7 +598,7 @@
         dest = os.path.basename(os.path.normpath(source))
 
     if os.path.exists(dest):
-        raise util.Abort("destination '%s' already exists", dest)
+        raise util.Abort(_("destination '%s' already exists"), dest)
 
     dest = os.path.realpath(dest)
 
@@ -670,14 +670,14 @@
 def commit(ui, repo, *pats, **opts):
     """commit the specified files or all outstanding changes"""
     if opts['text']:
-        ui.warn("Warning: -t and --text is deprecated,"
-                " please use -m or --message instead.\n")
+        ui.warn(_("Warning: -t and --text is deprecated,"
+                  " please use -m or --message instead.\n"))
     message = opts['message'] or opts['text']
     logfile = opts['logfile']
 
     if message and logfile:
-        raise util.Abort('options --message and --logfile are mutually '
-                         'exclusive')
+        raise util.Abort(_('options --message and --logfile are mutually '
+                           'exclusive'))
     if not message and logfile:
         try:
             if logfile == '-':
@@ -685,7 +685,7 @@
             else:
                 message = open(logfile).read()
         except IOError, inst:
-            raise util.Abort("can't read commit message '%s': %s" %
+            raise util.Abort(_("can't read commit message '%s': %s") %
                              (logfile, inst.strerror))
 
     if opts['addremove']:
@@ -708,19 +708,19 @@
 
 def docopy(ui, repo, pats, opts):
     if not pats:
-        raise util.Abort('no source or destination specified')
+        raise util.Abort(_('no source or destination specified'))
     elif len(pats) == 1:
-        raise util.Abort('no destination specified')
+        raise util.Abort(_('no destination specified'))
     pats = list(pats)
     dest = pats.pop()
     sources = []
 
     def okaytocopy(abs, rel, exact):
-        reasons = {'?': 'is not managed',
-                   'a': 'has been marked for add'}
+        reasons = {'?': _('is not managed'),
+                   'a': _('has been marked for add')}
         reason = reasons.get(repo.dirstate.state(abs))
         if reason:
-            if exact: ui.warn('%s: not copying - file %s\n' % (rel, reason))
+            if exact: ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
         else:
             return True
 
@@ -728,7 +728,7 @@
         if okaytocopy(abs, rel, exact):
             sources.append((abs, rel, exact))
     if not sources:
-        raise util.Abort('no files to copy')
+        raise util.Abort(_('no files to copy'))
 
     cwd = repo.getcwd()
     absdest = util.canonpath(repo.root, cwd, dest)
@@ -740,10 +740,10 @@
 
     if destisfile:
         if opts['parents']:
-            raise util.Abort('with --parents, destination must be a directory')
+            raise util.Abort(_('with --parents, destination must be a directory'))
         elif len(sources) > 1:
-            raise util.Abort('with multiple sources, destination must be a '
-                             'directory')
+            raise util.Abort(_('with multiple sources, destination must be a '
+                               'directory'))
     errs, copied = 0, []
     for abs, rel, exact in sources:
         if opts['parents']:
@@ -755,7 +755,7 @@
         myabsdest = util.canonpath(repo.root, cwd, mydest)
         myreldest = util.pathto(cwd, myabsdest)
         if not opts['force'] and repo.dirstate.state(myabsdest) not in 'a?':
-            ui.warn('%s: not overwriting - file already managed\n' % myreldest)
+            ui.warn(_('%s: not overwriting - file already managed\n') % myreldest)
             continue
         mydestdir = os.path.dirname(myreldest) or '.'
         if not opts['after']:
@@ -765,7 +765,7 @@
             except OSError, inst:
                 if inst.errno != errno.EEXIST: raise
         if ui.verbose or not exact:
-            ui.status('copying %s to %s\n' % (rel, myreldest))
+            ui.status(_('copying %s to %s\n') % (rel, myreldest))
         if not opts['after']:
             try:
                 shutil.copyfile(rel, myreldest)
@@ -774,15 +774,15 @@
                 raise util.Abort(str(inst))
             except IOError, inst:
                 if inst.errno == errno.ENOENT:
-                    ui.warn('%s: deleted in working copy\n' % rel)
+                    ui.warn(_('%s: deleted in working copy\n') % rel)
                 else:
-                    ui.warn('%s: cannot copy - %s\n' % (rel, inst.strerror))
+                    ui.warn(_('%s: cannot copy - %s\n') % (rel, inst.strerror))
                 errs += 1
                 continue
         repo.copy(abs, myabsdest)
         copied.append((abs, rel, exact))
     if errs:
-        ui.warn('(consider using --after)\n')
+        ui.warn(_('(consider using --after)\n'))
     return errs, copied
 
 def copy(ui, repo, *pats, **opts):
@@ -811,22 +811,22 @@
     for f in dc:
         state = repo.dirstate.state(f)
         if state in "nr" and f not in m1:
-            ui.warn("%s in state %s, but not in manifest1\n" % (f, state))
+            ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
             errors += 1
         if state in "a" and f in m1:
-            ui.warn("%s in state %s, but also in manifest1\n" % (f, state))
+            ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
             errors += 1
         if state in "m" and f not in m1 and f not in m2:
-            ui.warn("%s in state %s, but not in either manifest\n" %
+            ui.warn(_("%s in state %s, but not in either manifest\n") %
                     (f, state))
             errors += 1
     for f in m1:
         state = repo.dirstate.state(f)
         if state not in "nrm":
-            ui.warn("%s in manifest1, but listed as state %s" % (f, state))
+            ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
             errors += 1
     if errors:
-        raise util.Abort(".hg/dirstate inconsistent with current parent's manifest")
+        raise util.Abort(_(".hg/dirstate inconsistent with current parent's manifest"))
 
 def debugconfig(ui):
     """show combined config settings from all hgrc files"""
@@ -862,7 +862,7 @@
                     time.strftime("%x %X",
                                   time.localtime(dc[file_][3])), file_))
     for f in repo.dirstate.copies:
-        ui.write("copy: %s -> %s\n" % (repo.dirstate.copies[f], f))
+        ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f))
 
 def debugdata(ui, file_, rev):
     """dump the contents of an data file revision"""
@@ -870,7 +870,7 @@
     try:
         ui.write(r.revision(r.lookup(rev)))
     except KeyError:
-        raise util.Abort('invalid revision identifier %s', rev)
+        raise util.Abort(_('invalid revision identifier %s'), rev)
 
 def debugindex(ui, file_):
     """dump the contents of an index file"""
@@ -910,9 +910,9 @@
         n = r.tip()
     m = r.renamed(n)
     if m:
-        ui.write("renamed from %s:%s\n" % (m[0], hex(m[1])))
+        ui.write(_("renamed from %s:%s\n") % (m[0], hex(m[1])))
     else:
-        ui.write("not renamed\n")
+        ui.write(_("not renamed\n"))
 
 def debugwalk(ui, repo, *pats, **opts):
     """show how files match on given patterns"""
@@ -936,7 +936,7 @@
     if len(revs) > 1:
         node2 = revs[1]
     if len(revs) > 2:
-        raise util.Abort("too many revisions to diff")
+        raise util.Abort(_("too many revisions to diff"))
 
     fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
 
@@ -970,12 +970,12 @@
 def export(ui, repo, *changesets, **opts):
     """dump the header and diffs for one or more changesets"""
     if not changesets:
-        raise util.Abort("export requires at least one changeset")
+        raise util.Abort(_("export requires at least one changeset"))
     seqno = 0
     revs = list(revrange(ui, repo, changesets))
     total = len(revs)
     revwidth = max(map(len, revs))
-    ui.note(len(revs) > 1 and "Exporting patches:\n" or "Exporting patch:\n")
+    ui.note(len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n"))
     for cset in revs:
         seqno += 1
         doexport(ui, repo, cset, seqno, total, revwidth, opts)
@@ -987,7 +987,7 @@
         if repo.dirstate.state(abs) == 'a':
             forget.append(abs)
             if ui.verbose or not exact:
-                ui.status('forgetting ', rel, '\n')
+                ui.status(_('forgetting %s\n') % rel)
     repo.forget(forget)
 
 def grep(ui, repo, pattern, *pats, **opts):
@@ -1122,7 +1122,7 @@
     """print information about the working copy"""
     parents = [p for p in repo.dirstate.parents() if p != nullid]
     if not parents:
-        ui.write("unknown\n")
+        ui.write(_("unknown\n"))
         return
 
     hexfunc = ui.verbose and hex or short
@@ -1147,7 +1147,7 @@
     if not opts['force']:
         (c, a, d, u) = repo.changes()
         if c or a or d:
-            raise util.Abort("outstanding uncommitted changes")
+            raise util.Abort(_("outstanding uncommitted changes"))
 
     d = opts["base"]
     strip = opts["strip"]
@@ -1161,7 +1161,7 @@
                         '(---|\*\*\*)[ \t])')
 
     for patch in patches:
-        ui.status("applying %s\n" % patch)
+        ui.status(_("applying %s\n") % patch)
         pf = os.path.join(d, patch)
 
         message = []
@@ -1172,15 +1172,15 @@
             if (not message and not hgpatch and
                    mailre.match(line) and not opts['force']):
                 if len(line) > 35: line = line[:32] + '...'
-                raise util.Abort('first line looks like a '
-                                 'mail header: ' + line)
+                raise util.Abort(_('first line looks like a '
+                                   'mail header: ') + line)
             if diffre.match(line):
                 break
             elif hgpatch:
                 # parse values when importing the result of an hg export
                 if line.startswith("# User "):
                     user = line[7:]
-                    ui.debug('User: %s\n' % user)
+                    ui.debug(_('User: %s\n') % user)
                 elif not line.startswith("# ") and line:
                     message.append(line)
                     hgpatch = False
@@ -1192,10 +1192,10 @@
 
         # make sure message isn't empty
         if not message:
-            message = "imported patch %s\n" % patch
+            message = _("imported patch %s\n") % patch
         else:
             message = "%s\n" % '\n'.join(message)
-        ui.debug('message:\n%s\n' % message)
+        ui.debug(_('message:\n%s\n') % message)
 
         files = util.patch(strip, pf, ui)
 
@@ -1208,7 +1208,7 @@
     source = ui.expandpath(source)
     other = hg.repository(ui, source)
     if not other.local():
-        raise util.Abort("incoming doesn't work for remote repositories yet")
+        raise util.Abort(_("incoming doesn't work for remote repositories yet"))
     o = repo.findincoming(other)
     if not o:
         return
@@ -1355,7 +1355,7 @@
             if name == search:
                 ui.write("%s\n" % path)
                 return
-        ui.warn("not found!\n")
+        ui.warn(_("not found!\n"))
         return 1
     else:
         for name, path in ui.configitems("paths"):
@@ -1364,7 +1364,7 @@
 def pull(ui, repo, source="default", **opts):
     """pull changes from the specified source"""
     source = ui.expandpath(source)
-    ui.status('pulling from %s\n' % (source))
+    ui.status(_('pulling from %s\n') % (source))
 
     if opts['ssh']:
         ui.setconfig("ui", "ssh", opts['ssh'])
@@ -1377,7 +1377,7 @@
         if opts['update']:
             return update(ui, repo)
         else:
-            ui.status("(run 'hg update' to get a working copy)\n")
+            ui.status(_("(run 'hg update' to get a working copy)\n"))
 
     return r
 
@@ -1398,8 +1398,8 @@
 def rawcommit(ui, repo, *flist, **rc):
     "raw commit interface"
     if rc['text']:
-        ui.warn("Warning: -t and --text is deprecated,"
-                " please use -m or --message instead.\n")
+        ui.warn(_("Warning: -t and --text is deprecated,"
+                  " please use -m or --message instead.\n"))
     message = rc['message'] or rc['text']
     if not message and rc['logfile']:
         try:
@@ -1407,7 +1407,7 @@
         except IOError:
             pass
     if not message and not rc['logfile']:
-        raise util.Abort("missing commit message")
+        raise util.Abort(_("missing commit message"))
 
     files = relpath(repo, list(flist))
     if rc['files']:
@@ -1430,16 +1430,16 @@
     def okaytoremove(abs, rel, exact):
         c, a, d, u = repo.changes(files = [abs])
         reason = None
-        if c: reason = 'is modified'
-        elif a: reason = 'has been marked for add'
-        elif u: reason = 'is not managed'
+        if c: reason = _('is modified')
+        elif a: reason = _('has been marked for add')
+        elif u: reason = _('is not managed')
         if reason:
-            if exact: ui.warn('not removing %s: file %s\n' % (rel, reason))
+            if exact: ui.warn(_('not removing %s: file %s\n') % (rel, reason))
         else:
             return True
     for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
         if okaytoremove(abs, rel, exact):
-            if ui.verbose or not exact: ui.status('removing %s\n' % rel)
+            if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
             names.append(abs)
     for name in names:
         try:
@@ -1453,7 +1453,7 @@
     errs, copied = docopy(ui, repo, pats, opts)
     names = []
     for abs, rel, exact in copied:
-        if ui.verbose or not exact: ui.status('removing %s\n' % rel)
+        if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
         try:
             os.unlink(rel)
         except OSError, inst:
@@ -1505,7 +1505,7 @@
     r = repo.update(node, False, True, choose, False)
     for n in relnames:
         if n not in chosen:
-            ui.warn('error: no matches for %s\n' % n)
+            ui.warn(_('error: no matches for %s\n') % n)
             r = 1
     sys.stdout.flush()
     return r
@@ -1605,9 +1605,9 @@
             except socket.error:
                 pass
         if port != 80:
-            ui.status('listening at http://%s:%d/\n' % (addr, port))
+            ui.status(_('listening at http://%s:%d/\n') % (addr, port))
         else:
-            ui.status('listening at http://%s/\n' % addr)
+            ui.status(_('listening at http://%s/\n') % addr)
     httpd.serve_forever()
 
 def status(ui, repo, *pats, **opts):
@@ -1624,10 +1624,10 @@
     (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
                     for n in repo.changes(files=files, match=matchfn)]
 
-    changetypes = [('modified', 'M', c),
-                   ('added', 'A', a),
-                   ('removed', 'R', d),
-                   ('unknown', '?', u)]
+    changetypes = [(_('modified'), 'M', c),
+                   (_('added'), 'A', a),
+                   (_('removed'), 'R', d),
+                   (_('unknown'), '?', u)]
 
     end = opts['print0'] and '\0' or '\n'
 
@@ -1644,17 +1644,17 @@
 def tag(ui, repo, name, rev=None, **opts):
     """add a tag for the current tip or a given revision"""
     if opts['text']:
-        ui.warn("Warning: -t and --text is deprecated,"
-                " please use -m or --message instead.\n")
+        ui.warn(_("Warning: -t and --text is deprecated,"
+                  " please use -m or --message instead.\n"))
     if name == "tip":
-        raise util.Abort("the name 'tip' is reserved")
+        raise util.Abort(_("the name 'tip' is reserved"))
     if rev:
         r = hex(repo.lookup(rev))
     else:
         r = hex(repo.changelog.tip())
 
     if name.find(revrangesep) >= 0:
-        raise util.Abort("'%s' cannot be used in a tag name" % revrangesep)
+        raise util.Abort(_("'%s' cannot be used in a tag name") % revrangesep)
 
     if opts['local']:
         repo.opener("localtags", "a").write("%s %s\n" % (r, name))
@@ -1663,15 +1663,15 @@
     (c, a, d, u) = repo.changes()
     for x in (c, a, d, u):
         if ".hgtags" in x:
-            raise util.Abort("working copy of .hgtags is changed "
-                             "(please commit .hgtags manually)")
+            raise util.Abort(_("working copy of .hgtags is changed "
+                               "(please commit .hgtags manually)"))
 
     repo.wfile(".hgtags", "ab").write("%s %s\n" % (r, name))
     if repo.dirstate.state(".hgtags") == '?':
         repo.add([".hgtags"])
 
     message = (opts['message'] or opts['text'] or
-               "Added tag %s for changeset %s" % (name, r))
+               _("Added tag %s for changeset %s") % (name, r))
     try:
         repo.commit([".hgtags"], message, opts['user'], opts['date'])
     except ValueError, inst:
@@ -1699,7 +1699,7 @@
     f = urllib.urlopen(fname)
 
     if f.read(4) != "HG10":
-        raise util.Abort("%s: not a Mercurial bundle file" % fname)
+        raise util.Abort(_("%s: not a Mercurial bundle file") % fname)
 
     def bzgenerator(f):
         zd = bz2.BZ2Decompressor()
@@ -1745,15 +1745,15 @@
             if branch in br[x]:
                 found.append(x)
         if len(found) > 1:
-            ui.warn("Found multiple heads for %s\n" % branch)
+            ui.warn(_("Found multiple heads for %s\n") % branch)
             for x in found:
                 show_changeset(ui, repo, changenode=x, brinfo=br)
             return 1
         if len(found) == 1:
             node = found[0]
-            ui.warn("Using head %s for branch %s\n" % (short(node), branch))
+            ui.warn(_("Using head %s for branch %s\n") % (short(node), branch))
         else:
-            ui.warn("branch %s not found\n" % (branch))
+            ui.warn(_("branch %s not found\n") % (branch))
             return 1
     else:
         node = node and repo.lookup(node) or repo.changelog.tip()
@@ -1768,243 +1768,243 @@
 table = {
     "^add":
         (add,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
          "hg add [OPTION]... [FILE]..."),
     "addremove":
         (addremove,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         "hg addremove [OPTION]... [FILE]..."),
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _("hg addremove [OPTION]... [FILE]...")),
     "^annotate":
         (annotate,
-         [('r', 'rev', '', 'revision'),
-          ('a', 'text', None, 'treat all files as text'),
-          ('u', 'user', None, 'show user'),
-          ('n', 'number', None, 'show revision number'),
-          ('c', 'changeset', None, 'show changeset'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         'hg annotate [OPTION]... FILE...'),
+         [('r', 'rev', '', _('revision')),
+          ('a', 'text', None, _('treat all files as text')),
+          ('u', 'user', None, _('show user')),
+          ('n', 'number', None, _('show revision number')),
+          ('c', 'changeset', None, _('show changeset')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _('hg annotate [OPTION]... FILE...')),
     "bundle":
         (bundle,
          [],
-         'hg bundle FILE DEST'),
+         _('hg bundle FILE DEST')),
     "cat":
         (cat,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search'),
-          ('o', 'output', "", 'output to file'),
-          ('r', 'rev', '', 'revision')],
-         'hg cat [OPTION]... FILE...'),
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search')),
+          ('o', 'output', "", _('output to file')),
+          ('r', 'rev', '', _('revision'))],
+         _('hg cat [OPTION]... FILE...')),
     "^clone":
         (clone,
-         [('U', 'noupdate', None, 'skip update after cloning'),
-          ('e', 'ssh', "", 'ssh command'),
-          ('', 'pull', None, 'use pull protocol to copy metadata'),
-          ('', 'remotecmd', "", 'remote hg command')],
-         'hg clone [OPTION]... SOURCE [DEST]'),
+         [('U', 'noupdate', None, _('skip update after cloning')),
+          ('e', 'ssh', "", _('ssh command')),
+          ('', 'pull', None, _('use pull protocol to copy metadata')),
+          ('', 'remotecmd', "", _('remote hg command'))],
+         _('hg clone [OPTION]... SOURCE [DEST]')),
     "^commit|ci":
         (commit,
-         [('A', 'addremove', None, 'run add/remove during commit'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search'),
-          ('m', 'message', "", 'commit message'),
-          ('t', 'text', "", 'commit message (deprecated: use -m)'),
-          ('l', 'logfile', "", 'commit message file'),
-          ('d', 'date', "", 'date code'),
-          ('u', 'user', "", 'user')],
-         'hg commit [OPTION]... [FILE]...'),
+         [('A', 'addremove', None, _('run add/remove during commit')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search')),
+          ('m', 'message', "", _('commit message')),
+          ('t', 'text', "", _('commit message (deprecated: use -m)')),
+          ('l', 'logfile', "", _('commit message file')),
+          ('d', 'date', "", _('date code')),
+          ('u', 'user', "", _('user'))],
+         _('hg commit [OPTION]... [FILE]...')),
     "copy|cp": (copy,
-             [('I', 'include', [], 'include path in search'),
-              ('X', 'exclude', [], 'exclude path from search'),
-              ('A', 'after', None, 'record a copy after it has happened'),
-              ('f', 'force', None, 'replace destination if it exists'),
-              ('p', 'parents', None, 'append source path to dest')],
-             'hg copy [OPTION]... [SOURCE]... DEST'),
-    "debugancestor": (debugancestor, [], 'debugancestor INDEX REV1 REV2'),
-    "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'),
-    "debugconfig": (debugconfig, [], 'debugconfig'),
-    "debugsetparents": (debugsetparents, [], 'debugsetparents REV1 [REV2]'),
-    "debugstate": (debugstate, [], 'debugstate'),
-    "debugdata": (debugdata, [], 'debugdata FILE REV'),
-    "debugindex": (debugindex, [], 'debugindex FILE'),
-    "debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
-    "debugrename": (debugrename, [], 'debugrename FILE [REV]'),
+             [('I', 'include', [], _('include path in search')),
+              ('X', 'exclude', [], _('exclude path from search')),
+              ('A', 'after', None, _('record a copy after it has happened')),
+              ('f', 'force', None, _('replace destination if it exists')),
+              ('p', 'parents', None, _('append source path to dest'))],
+             _('hg copy [OPTION]... [SOURCE]... DEST')),
+    "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
+    "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
+    "debugconfig": (debugconfig, [], _('debugconfig')),
+    "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')),
+    "debugstate": (debugstate, [], _('debugstate')),
+    "debugdata": (debugdata, [], _('debugdata FILE REV')),
+    "debugindex": (debugindex, [], _('debugindex FILE')),
+    "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')),
+    "debugrename": (debugrename, [], _('debugrename FILE [REV]')),
     "debugwalk":
         (debugwalk,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         'debugwalk [OPTION]... [FILE]...'),
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _('debugwalk [OPTION]... [FILE]...')),
     "^diff":
         (diff,
-         [('r', 'rev', [], 'revision'),
-          ('a', 'text', None, 'treat all files as text'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         'hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...'),
+         [('r', 'rev', [], _('revision')),
+          ('a', 'text', None, _('treat all files as text')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
     "^export":
         (export,
-         [('o', 'output', "", 'output to file'),
-          ('a', 'text', None, 'treat all files as text')],
-         "hg export [-a] [-o OUTFILE] REV..."),
+         [('o', 'output', "", _('output to file')),
+          ('a', 'text', None, _('treat all files as text'))],
+         _("hg export [-a] [-o OUTFILE] REV...")),
     "forget":
         (forget,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         "hg forget [OPTION]... FILE..."),
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _("hg forget [OPTION]... FILE...")),
     "grep":
         (grep,
-         [('0', 'print0', None, 'end fields with NUL'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'include path in search'),
-          ('', 'all', None, 'print all revisions with matches'),
-          ('i', 'ignore-case', None, 'ignore case when matching'),
-          ('l', 'files-with-matches', None, 'print names of files and revs with matches'),
-          ('n', 'line-number', None, 'print line numbers'),
-          ('r', 'rev', [], 'search in revision rev'),
-          ('u', 'user', None, 'print user who made change')],
-         "hg grep [OPTION]... PATTERN [FILE]..."),
+         [('0', 'print0', None, _('end fields with NUL')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('include path in search')),
+          ('', 'all', None, _('print all revisions with matches')),
+          ('i', 'ignore-case', None, _('ignore case when matching')),
+          ('l', 'files-with-matches', None, _('print names of files and revs with matches')),
+          ('n', 'line-number', None, _('print line numbers')),
+          ('r', 'rev', [], _('search in revision rev')),
+          ('u', 'user', None, _('print user who made change'))],
+         _("hg grep [OPTION]... PATTERN [FILE]...")),
     "heads":
         (heads,
-         [('b', 'branches', None, 'find branch info')],
-         'hg heads [-b]'),
-    "help": (help_, [], 'hg help [COMMAND]'),
-    "identify|id": (identify, [], 'hg identify'),
+         [('b', 'branches', None, _('find branch info'))],
+         _('hg heads [-b]')),
+    "help": (help_, [], _('hg help [COMMAND]')),
+    "identify|id": (identify, [], _('hg identify')),
     "import|patch":
         (import_,
-         [('p', 'strip', 1, 'path strip'),
-          ('f', 'force', None, 'skip check for outstanding changes'),
-          ('b', 'base', "", 'base path')],
-         "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
+         [('p', 'strip', 1, _('path strip')),
+          ('f', 'force', None, _('skip check for outstanding changes')),
+          ('b', 'base', "", _('base path'))],
+         _("hg import [-f] [-p NUM] [-b BASE] PATCH...")),
     "incoming|in": (incoming,
-         [('p', 'patch', None, 'show patch')],
-         'hg incoming [-p] [SOURCE]'),
-    "^init": (init, [], 'hg init [DEST]'),
+         [('p', 'patch', None, _('show patch'))],
+         _('hg incoming [-p] [SOURCE]')),
+    "^init": (init, [], _('hg init [DEST]')),
     "locate":
         (locate,
-         [('r', 'rev', '', 'revision'),
-          ('0', 'print0', None, 'end filenames with NUL'),
-          ('f', 'fullpath', None, 'print complete paths'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         'hg locate [OPTION]... [PATTERN]...'),
+         [('r', 'rev', '', _('revision')),
+          ('0', 'print0', None, _('end filenames with NUL')),
+          ('f', 'fullpath', None, _('print complete paths')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _('hg locate [OPTION]... [PATTERN]...')),
     "^log|history":
         (log,
-         [('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search'),
-          ('b', 'branch', None, 'show branches'),
-          ('k', 'keyword', [], 'search for a keyword'),
-          ('r', 'rev', [], 'revision'),
-          ('p', 'patch', None, 'show patch')],
-         'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
-    "manifest": (manifest, [], 'hg manifest [REV]'),
+         [('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search')),
+          ('b', 'branch', None, _('show branches')),
+          ('k', 'keyword', [], _('search for a keyword')),
+          ('r', 'rev', [], _('revision')),
+          ('p', 'patch', None, _('show patch'))],
+         _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
+    "manifest": (manifest, [], _('hg manifest [REV]')),
     "outgoing|out": (outgoing,
-         [('p', 'patch', None, 'show patch')],
-         'hg outgoing [-p] [DEST]'),
-    "parents": (parents, [], 'hg parents [REV]'),
-    "paths": (paths, [], 'hg paths [NAME]'),
+         [('p', 'patch', None, _('show patch'))],
+         _('hg outgoing [-p] [DEST]')),
+    "parents": (parents, [], _('hg parents [REV]')),
+    "paths": (paths, [], _('hg paths [NAME]')),
     "^pull":
         (pull,
-         [('u', 'update', None, 'update working directory'),
-          ('e', 'ssh', "", 'ssh command'),
-          ('', 'remotecmd', "", 'remote hg command')],
-         'hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]'),
+         [('u', 'update', None, _('update working directory')),
+          ('e', 'ssh', "", _('ssh command')),
+          ('', 'remotecmd', "", _('remote hg command'))],
+         _('hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]')),
     "^push":
         (push,
-         [('f', 'force', None, 'force push'),
-          ('e', 'ssh', "", 'ssh command'),
-          ('', 'remotecmd', "", 'remote hg command')],
-         'hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]'),
+         [('f', 'force', None, _('force push')),
+          ('e', 'ssh', "", _('ssh command')),
+          ('', 'remotecmd', "", _('remote hg command'))],
+         _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
     "rawcommit":
         (rawcommit,
-         [('p', 'parent', [], 'parent'),
-          ('d', 'date', "", 'date code'),
-          ('u', 'user', "", 'user'),
-          ('F', 'files', "", 'file list'),
-          ('m', 'message', "", 'commit message'),
-          ('t', 'text', "", 'commit message (deprecated: use -m)'),
-          ('l', 'logfile', "", 'commit message file')],
-         'hg rawcommit [OPTION]... [FILE]...'),
-    "recover": (recover, [], "hg recover"),
+         [('p', 'parent', [], _('parent')),
+          ('d', 'date', "", _('date code')),
+          ('u', 'user', "", _('user')),
+          ('F', 'files', "", _('file list')),
+          ('m', 'message', "", _('commit message')),
+          ('t', 'text', "", _('commit message (deprecated: use -m)')),
+          ('l', 'logfile', "", _('commit message file'))],
+         _('hg rawcommit [OPTION]... [FILE]...')),
+    "recover": (recover, [], _("hg recover")),
     "^remove|rm": (remove,
-                   [('I', 'include', [], 'include path in search'),
-                    ('X', 'exclude', [], 'exclude path from search')],
-                   "hg remove [OPTION]... FILE..."),
+                   [('I', 'include', [], _('include path in search')),
+                    ('X', 'exclude', [], _('exclude path from search'))],
+                   _("hg remove [OPTION]... FILE...")),
     "rename|mv": (rename,
-                  [('I', 'include', [], 'include path in search'),
-                   ('X', 'exclude', [], 'exclude path from search'),
-                   ('A', 'after', None, 'record a copy after it has happened'),
-                   ('f', 'force', None, 'replace destination if it exists'),
-                   ('p', 'parents', None, 'append source path to dest')],
-                  'hg rename [OPTION]... [SOURCE]... DEST'),
+                  [('I', 'include', [], _('include path in search')),
+                   ('X', 'exclude', [], _('exclude path from search')),
+                   ('A', 'after', None, _('record a copy after it has happened')),
+                   ('f', 'force', None, _('replace destination if it exists')),
+                   ('p', 'parents', None, _('append source path to dest'))],
+                  _('hg rename [OPTION]... [SOURCE]... DEST')),
     "^revert":
         (revert,
-         [("n", "nonrecursive", None, "don't recurse into subdirs"),
-          ("r", "rev", "", "revision")],
-         "hg revert [-n] [-r REV] [NAME]..."),
-    "root": (root, [], "hg root"),
+         [("n", "nonrecursive", None, _("don't recurse into subdirs")),
+          ("r", "rev", "", _("revision"))],
+         _("hg revert [-n] [-r REV] [NAME]...")),
+    "root": (root, [], _("hg root")),
     "^serve":
         (serve,
-         [('A', 'accesslog', '', 'access log file'),
-          ('E', 'errorlog', '', 'error log file'),
-          ('p', 'port', 0, 'listen port'),
-          ('a', 'address', '', 'interface address'),
-          ('n', 'name', "", 'repository name'),
-          ('', 'stdio', None, 'for remote clients'),
-          ('t', 'templates', "", 'template directory'),
-          ('', 'style', "", 'template style'),
-          ('6', 'ipv6', None, 'use IPv6 in addition to IPv4')],
-         "hg serve [OPTION]..."),
+         [('A', 'accesslog', '', _('access log file')),
+          ('E', 'errorlog', '', _('error log file')),
+          ('p', 'port', 0, _('listen port')),
+          ('a', 'address', '', _('interface address')),
+          ('n', 'name', "", _('repository name')),
+          ('', 'stdio', None, _('for remote clients')),
+          ('t', 'templates', "", _('template directory')),
+          ('', 'style', "", _('template style')),
+          ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
+         _("hg serve [OPTION]...")),
     "^status":
         (status,
-         [('m', 'modified', None, 'show only modified files'),
-          ('a', 'added', None, 'show only added files'),
-          ('r', 'removed', None, 'show only removed files'),
-          ('u', 'unknown', None, 'show only unknown (not tracked) files'),
-          ('n', 'no-status', None, 'hide status prefix'),
-          ('0', 'print0', None, 'end filenames with NUL'),
-          ('I', 'include', [], 'include path in search'),
-          ('X', 'exclude', [], 'exclude path from search')],
-         "hg status [OPTION]... [FILE]..."),
+         [('m', 'modified', None, _('show only modified files')),
+          ('a', 'added', None, _('show only added files')),
+          ('r', 'removed', None, _('show only removed files')),
+          ('u', 'unknown', None, _('show only unknown (not tracked) files')),
+          ('n', 'no-status', None, _('hide status prefix')),
+          ('0', 'print0', None, _('end filenames with NUL')),
+          ('I', 'include', [], _('include path in search')),
+          ('X', 'exclude', [], _('exclude path from search'))],
+         _("hg status [OPTION]... [FILE]...")),
     "tag":
         (tag,
-         [('l', 'local', None, 'make the tag local'),
-          ('m', 'message', "", 'commit message'),
-          ('t', 'text', "", 'commit message (deprecated: use -m)'),
-          ('d', 'date', "", 'date code'),
-          ('u', 'user', "", 'user')],
-         'hg tag [OPTION]... NAME [REV]'),
-    "tags": (tags, [], 'hg tags'),
-    "tip": (tip, [], 'hg tip'),
+         [('l', 'local', None, _('make the tag local')),
+          ('m', 'message', "", _('commit message')),
+          ('t', 'text', "", _('commit message (deprecated: use -m)')),
+          ('d', 'date', "", _('date code')),
+          ('u', 'user', "", _('user'))],
+         _('hg tag [OPTION]... NAME [REV]')),
+    "tags": (tags, [], _('hg tags')),
+    "tip": (tip, [], _('hg tip')),
     "unbundle":
         (unbundle,
          [],
-         'hg unbundle FILE'),
-    "undo": (undo, [], 'hg undo'),
+         _('hg unbundle FILE')),
+    "undo": (undo, [], _('hg undo')),
     "^update|up|checkout|co":
         (update,
-         [('b', 'branch', "", 'checkout the head of a specific branch'),
-          ('m', 'merge', None, 'allow merging of conflicts'),
-          ('C', 'clean', None, 'overwrite locally modified files')],
-         'hg update [-b TAG] [-m] [-C] [REV]'),
-    "verify": (verify, [], 'hg verify'),
-    "version": (show_version, [], 'hg version'),
+         [('b', 'branch', "", _('checkout the head of a specific branch')),
+          ('m', 'merge', None, _('allow merging of conflicts')),
+          ('C', 'clean', None, _('overwrite locally modified files'))],
+         _('hg update [-b TAG] [-m] [-C] [REV]')),
+    "verify": (verify, [], _('hg verify')),
+    "version": (show_version, [], _('hg version')),
 }
 
 globalopts = [
-    ('R', 'repository', "", 'repository root directory'),
-    ('', 'cwd', '', 'change working directory'),
-    ('y', 'noninteractive', None, 'run non-interactively'),
-    ('q', 'quiet', None, 'quiet mode'),
-    ('v', 'verbose', None, 'verbose mode'),
-    ('', 'debug', None, 'debug mode'),
-    ('', 'debugger', None, 'start debugger'),
-    ('', 'traceback', None, 'print traceback on exception'),
-    ('', 'time', None, 'time how long the command takes'),
-    ('', 'profile', None, 'profile'),
-    ('', 'version', None, 'output version information and exit'),
-    ('h', 'help', None, 'display help and exit'),
+    ('R', 'repository', "", _('repository root directory')),
+    ('', 'cwd', '', _('change working directory')),
+    ('y', 'noninteractive', None, _('run non-interactively')),
+    ('q', 'quiet', None, _('quiet mode')),
+    ('v', 'verbose', None, _('verbose mode')),
+    ('', 'debug', None, _('debug mode')),
+    ('', 'debugger', None, _('start debugger')),
+    ('', 'traceback', None, _('print traceback on exception')),
+    ('', 'time', None, _('time how long the command takes')),
+    ('', 'profile', None, _('profile')),
+    ('', 'version', None, _('output version information and exit')),
+    ('h', 'help', None, _('display help and exit')),
 ]
 
 norepo = ("clone init version help debugancestor debugconfig debugdata"
@@ -2077,7 +2077,7 @@
             try:
                 mod = imp.load_source(x[0], x[1])
             except:
-                u.warn("*** failed to import extension %s\n" % x[1])
+                u.warn(_("*** failed to import extension %s\n") % x[1])
                 continue
         else:
             def importh(name):
@@ -2089,7 +2089,7 @@
             try:
                 mod = importh(x[0])
             except:
-                u.warn("failed to import extension %s\n" % x[0])
+                u.warn(_("failed to import extension %s\n") % x[0])
                 continue
 
         external.append(mod)
@@ -2097,21 +2097,21 @@
         cmdtable = getattr(x, 'cmdtable', {})
         for t in cmdtable:
             if t in table:
-                u.warn("module %s overrides %s\n" % (x.__name__, t))
+                u.warn(_("module %s overrides %s\n") % (x.__name__, t))
         table.update(cmdtable)
 
     try:
         cmd, func, args, options, cmdoptions = parse(args)
     except ParseError, inst:
         if inst.args[0]:
-            u.warn("hg %s: %s\n" % (inst.args[0], inst.args[1]))
+            u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
             help_(u, inst.args[0])
         else:
-            u.warn("hg: %s\n" % inst.args[1])
+            u.warn(_("hg: %s\n") % inst.args[1])
             help_(u, 'shortlist')
         sys.exit(-1)
     except UnknownCommand, inst:
-        u.warn("hg: unknown command '%s'\n" % inst.args[0])
+        u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
         help_(u, 'shortlist')
         sys.exit(1)
 
@@ -2124,7 +2124,7 @@
         s = get_times()
         def print_time():
             t = get_times()
-            u.warn("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n" %
+            u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
                 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
         atexit.register(print_time)
 
@@ -2183,42 +2183,42 @@
                 traceback.print_exc()
             raise
     except hg.RepoError, inst:
-        u.warn("abort: ", inst, "!\n")
+        u.warn(_("abort: "), inst, "!\n")
     except revlog.RevlogError, inst:
-        u.warn("abort: ", inst, "!\n")
+        u.warn(_("abort: "), inst, "!\n")
     except SignalInterrupt:
-        u.warn("killed!\n")
+        u.warn(_("killed!\n"))
     except KeyboardInterrupt:
         try:
-            u.warn("interrupted!\n")
+            u.warn(_("interrupted!\n"))
         except IOError, inst:
             if inst.errno == errno.EPIPE:
                 if u.debugflag:
-                    u.warn("\nbroken pipe\n")
+                    u.warn(_("\nbroken pipe\n"))
             else:
                 raise
     except IOError, inst:
         if hasattr(inst, "code"):
-            u.warn("abort: %s\n" % inst)
+            u.warn(_("abort: %s\n") % inst)
         elif hasattr(inst, "reason"):
-            u.warn("abort: error: %s\n" % inst.reason[1])
+            u.warn(_("abort: error: %s\n") % inst.reason[1])
         elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
             if u.debugflag:
-                u.warn("broken pipe\n")
+                u.warn(_("broken pipe\n"))
         elif getattr(inst, "strerror", None):
             if getattr(inst, "filename", None):
-                u.warn("abort: %s - %s\n" % (inst.strerror, inst.filename))
+                u.warn(_("abort: %s - %s\n") % (inst.strerror, inst.filename))
             else:
-                u.warn("abort: %s\n" % inst.strerror)
+                u.warn(_("abort: %s\n") % inst.strerror)
         else:
             raise
     except OSError, inst:
         if hasattr(inst, "filename"):
-            u.warn("abort: %s: %s\n" % (inst.strerror, inst.filename))
+            u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
         else:
-            u.warn("abort: %s\n" % inst.strerror)
+            u.warn(_("abort: %s\n") % inst.strerror)
     except util.Abort, inst:
-        u.warn('abort: ', inst.args[0] % inst.args[1:], '\n')
+        u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n')
         sys.exit(1)
     except TypeError, inst:
         # was this an argument error?
@@ -2226,17 +2226,17 @@
         if len(tb) > 2: # no
             raise
         u.debug(inst, "\n")
-        u.warn("%s: invalid arguments\n" % cmd)
+        u.warn(_("%s: invalid arguments\n") % cmd)
         help_(u, cmd)
     except UnknownCommand, inst:
-        u.warn("hg: unknown command '%s'\n" % inst.args[0])
+        u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
         help_(u, 'shortlist')
     except SystemExit:
         # don't catch this in the catch-all below
         raise
     except:
-        u.warn("** unknown exception encountered, details follow\n")
-        u.warn("** report bug details to mercurial@selenic.com\n")
+        u.warn(_("** unknown exception encountered, details follow\n"))
+        u.warn(_("** report bug details to mercurial@selenic.com\n"))
         raise
 
     sys.exit(-1)
--- a/mercurial/dirstate.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/dirstate.py	Tue Oct 18 18:38:39 2005 -0700
@@ -68,7 +68,7 @@
                     try:
                         syntax = syntaxes[s]
                     except KeyError:
-                        self.ui.warn("ignoring invalid syntax '%s'\n" % s)
+                        self.ui.warn(_("ignoring invalid syntax '%s'\n") % s)
                     continue
                 pat = syntax + line
                 for s in syntaxes.values():
@@ -190,7 +190,7 @@
             try:
                 del self.map[f]
             except KeyError:
-                self.ui.warn("not in dirstate: %s!\n" % f)
+                self.ui.warn(_("not in dirstate: %s!\n") % f)
                 pass
 
     def clear(self):
@@ -276,13 +276,13 @@
                 return True
             else:
                 kind = 'unknown'
-                if stat.S_ISCHR(st.st_mode): kind = 'character device'
-                elif stat.S_ISBLK(st.st_mode): kind = 'block device'
-                elif stat.S_ISFIFO(st.st_mode): kind = 'fifo'
-                elif stat.S_ISLNK(st.st_mode): kind = 'symbolic link'
-                elif stat.S_ISSOCK(st.st_mode): kind = 'socket'
-                elif stat.S_ISDIR(st.st_mode): kind = 'directory'
-                self.ui.warn('%s: unsupported file type (type is %s)\n' % (
+                if stat.S_ISCHR(st.st_mode): kind = _('character device')
+                elif stat.S_ISBLK(st.st_mode): kind = _('block device')
+                elif stat.S_ISFIFO(st.st_mode): kind = _('fifo')
+                elif stat.S_ISLNK(st.st_mode): kind = _('symbolic link')
+                elif stat.S_ISSOCK(st.st_mode): kind = _('socket')
+                elif stat.S_ISDIR(st.st_mode): kind = _('directory')
+                self.ui.warn(_('%s: unsupported file type (type is %s)\n') % (
                     util.pathto(self.getcwd(), f),
                     kind))
                 return False
--- a/mercurial/hgweb.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/hgweb.py	Tue Oct 18 18:38:39 2005 -0700
@@ -112,7 +112,7 @@
                 if m:
                     self.map[m.group(1)] = os.path.join(self.base, m.group(2))
                 else:
-                    raise LookupError("unknown map entry '%s'" % l)
+                    raise LookupError(_("unknown map entry '%s'") % l)
 
     def __call__(self, t, **map):
         m = self.defaults.copy()
@@ -844,7 +844,7 @@
 
         def __init__(self, *args, **kwargs):
             if self.address_family is None:
-                raise hg.RepoError('IPv6 not available on this system')
+                raise hg.RepoError(_('IPv6 not available on this system'))
             BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
 
     class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler):
--- a/mercurial/httprepo.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/httprepo.py	Tue Oct 18 18:38:39 2005 -0700
@@ -68,7 +68,7 @@
         return -1
 
     def do_cmd(self, cmd, **args):
-        self.ui.debug("sending %s command\n" % cmd)
+        self.ui.debug(_("sending %s command\n") % cmd)
         q = {"cmd": cmd}
         q.update(args)
         qs = urllib.urlencode(q)
@@ -80,13 +80,13 @@
         if not proto.startswith('application/mercurial') and \
                not proto.startswith('text/plain') and \
                not proto.startswith('application/hg-changegroup'):
-            raise hg.RepoError("'%s' does not appear to be an hg repository" %
+            raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
                                self.url)
 
         if proto.startswith('application/mercurial'):
             version = proto[22:]
             if float(version) > 0.1:
-                raise hg.RepoError("'%s' uses newer protocol %s" %
+                raise hg.RepoError(_("'%s' uses newer protocol %s") %
                                    (self.url, version))
 
         return resp
@@ -96,7 +96,7 @@
         try:
             return map(bin, d[:-1].split(" "))
         except:
-            self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
+            self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
             raise
 
     def branches(self, nodes):
@@ -106,7 +106,7 @@
             br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
             return br
         except:
-            self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
+            self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
             raise
 
     def between(self, pairs):
@@ -116,7 +116,7 @@
             p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
             return p
         except:
-            self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
+            self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
             raise
 
     def changegroup(self, nodes):
--- a/mercurial/localrepo.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/localrepo.py	Tue Oct 18 18:38:39 2005 -0700
@@ -19,12 +19,12 @@
             while not os.path.isdir(os.path.join(p, ".hg")):
                 oldp = p
                 p = os.path.dirname(p)
-                if p == oldp: raise repo.RepoError("no repo found")
+                if p == oldp: raise repo.RepoError(_("no repo found"))
             path = p
         self.path = os.path.join(path, ".hg")
 
         if not create and not os.path.isdir(self.path):
-            raise repo.RepoError("repository %s not found" % self.path)
+            raise repo.RepoError(_("repository %s not found") % self.path)
 
         self.root = os.path.abspath(path)
         self.ui = ui
@@ -49,7 +49,7 @@
     def hook(self, name, **args):
         s = self.ui.config("hooks", name)
         if s:
-            self.ui.note("running hook %s: %s\n" % (name, s))
+            self.ui.note(_("running hook %s: %s\n") % (name, s))
             old = {}
             for k, v in args.items():
                 k = k.upper()
@@ -69,7 +69,7 @@
                     del os.environ[k]
 
             if r:
-                self.ui.warn("abort: %s hook failed with status %d!\n" %
+                self.ui.warn(_("abort: %s hook failed with status %d!\n") %
                              (name, r))
                 return False
         return True
@@ -139,7 +139,7 @@
             try:
                 return self.changelog.lookup(key)
             except:
-                raise repo.RepoError("unknown revision '%s'" % key)
+                raise repo.RepoError(_("unknown revision '%s'") % key)
 
     def dev(self):
         return os.stat(self.path).st_dev
@@ -175,7 +175,7 @@
 
         for mf, cmd in self.encodepats:
             if mf(filename):
-                self.ui.debug("filtering %s through %s\n" % (filename, cmd))
+                self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
                 data = util.filter(data, cmd)
                 break
 
@@ -191,7 +191,7 @@
 
         for mf, cmd in self.decodepats:
             if mf(filename):
-                self.ui.debug("filtering %s through %s\n" % (filename, cmd))
+                self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
                 data = util.filter(data, cmd)
                 break
 
@@ -218,28 +218,28 @@
     def recover(self):
         lock = self.lock()
         if os.path.exists(self.join("journal")):
-            self.ui.status("rolling back interrupted transaction\n")
+            self.ui.status(_("rolling back interrupted transaction\n"))
             return transaction.rollback(self.opener, self.join("journal"))
         else:
-            self.ui.warn("no interrupted transaction available\n")
+            self.ui.warn(_("no interrupted transaction available\n"))
 
     def undo(self):
         lock = self.lock()
         if os.path.exists(self.join("undo")):
-            self.ui.status("rolling back last transaction\n")
+            self.ui.status(_("rolling back last transaction\n"))
             transaction.rollback(self.opener, self.join("undo"))
             self.dirstate = None
             util.rename(self.join("undo.dirstate"), self.join("dirstate"))
             self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root)
         else:
-            self.ui.warn("no undo information available\n")
+            self.ui.warn(_("no undo information available\n"))
 
     def lock(self, wait=1):
         try:
             return lock.lock(self.join("lock"), 0)
         except lock.LockHeld, inst:
             if wait:
-                self.ui.warn("waiting for lock held by %s\n" % inst.args[0])
+                self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0])
                 return lock.lock(self.join("lock"), wait)
             raise inst
 
@@ -327,7 +327,7 @@
                 elif s == 'r':
                     remove.append(f)
                 else:
-                    self.ui.warn("%s not tracked!\n" % f)
+                    self.ui.warn(_("%s not tracked!\n") % f)
         else:
             (c, a, d, u) = self.changes(match=match)
             commit = c + a
@@ -341,7 +341,7 @@
         m2 = self.manifest.read(c2[0])
 
         if not commit and not remove and not force and p2 == nullid:
-            self.ui.status("nothing changed\n")
+            self.ui.status(_("nothing changed\n"))
             return None
 
         if not self.hook("precommit"):
@@ -360,7 +360,7 @@
                 mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False))
                 t = self.wread(f)
             except IOError:
-                self.ui.warn("trouble committing %s!\n" % f)
+                self.ui.warn(_("trouble committing %s!\n") % f)
                 raise
 
             r = self.file(f)
@@ -370,7 +370,7 @@
             if cp:
                 meta["copy"] = cp
                 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid)))
-                self.ui.debug(" %s: copy %s:%s\n" % (f, cp, meta["copyrev"]))
+                self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"]))
                 fp1, fp2 = nullid, nullid
             else:
                 fp1 = m1.get(f, nullid)
@@ -521,18 +521,18 @@
         for f in list:
             p = self.wjoin(f)
             if not os.path.exists(p):
-                self.ui.warn("%s does not exist!\n" % f)
+                self.ui.warn(_("%s does not exist!\n") % f)
             elif not os.path.isfile(p):
-                self.ui.warn("%s not added: only files supported currently\n" % f)
+                self.ui.warn(_("%s not added: only files supported currently\n") % f)
             elif self.dirstate.state(f) in 'an':
-                self.ui.warn("%s already tracked!\n" % f)
+                self.ui.warn(_("%s already tracked!\n") % f)
             else:
                 self.dirstate.update([f], "a")
 
     def forget(self, list):
         for f in list:
             if self.dirstate.state(f) not in 'ai':
-                self.ui.warn("%s not added!\n" % f)
+                self.ui.warn(_("%s not added!\n") % f)
             else:
                 self.dirstate.forget([f])
 
@@ -540,21 +540,21 @@
         for f in list:
             p = self.wjoin(f)
             if os.path.exists(p):
-                self.ui.warn("%s still exists!\n" % f)
+                self.ui.warn(_("%s still exists!\n") % f)
             elif self.dirstate.state(f) == 'a':
-                self.ui.warn("%s never committed!\n" % f)
+                self.ui.warn(_("%s never committed!\n") % f)
                 self.dirstate.forget([f])
             elif f not in self.dirstate:
-                self.ui.warn("%s not tracked!\n" % f)
+                self.ui.warn(_("%s not tracked!\n") % f)
             else:
                 self.dirstate.update([f], "r")
 
     def copy(self, source, dest):
         p = self.wjoin(dest)
         if not os.path.exists(p):
-            self.ui.warn("%s does not exist!\n" % dest)
+            self.ui.warn(_("%s does not exist!\n") % dest)
         elif not os.path.isfile(p):
-            self.ui.warn("copy failed: %s is not a file\n" % dest)
+            self.ui.warn(_("copy failed: %s is not a file\n") % dest)
         else:
             if self.dirstate.state(dest) == '?':
                 self.dirstate.update([dest], "a")
@@ -738,7 +738,7 @@
 
         # assume we're closer to the tip than the root
         # and start by examining the heads
-        self.ui.status("searching for changes\n")
+        self.ui.status(_("searching for changes\n"))
 
         if not heads:
             heads = remote.heads()
@@ -768,21 +768,21 @@
                 if n[0] in seen:
                     continue
 
-                self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
+                self.ui.debug(_("examining %s:%s\n") % (short(n[0]), short(n[1])))
                 if n[0] == nullid:
                     break
                 if n in seenbranch:
-                    self.ui.debug("branch already found\n")
+                    self.ui.debug(_("branch already found\n"))
                     continue
                 if n[1] and n[1] in m: # do we know the base?
-                    self.ui.debug("found incomplete branch %s:%s\n"
+                    self.ui.debug(_("found incomplete branch %s:%s\n")
                                   % (short(n[0]), short(n[1])))
                     search.append(n) # schedule branch range for scanning
                     seenbranch[n] = 1
                 else:
                     if n[1] not in seen and n[1] not in fetch:
                         if n[2] in m and n[3] in m:
-                            self.ui.debug("found new changeset %s\n" %
+                            self.ui.debug(_("found new changeset %s\n") %
                                           short(n[1]))
                             fetch[n[1]] = 1 # earliest unknown
                             base[n[2]] = 1 # latest known
@@ -797,14 +797,14 @@
 
             if r:
                 reqcnt += 1
-                self.ui.debug("request %d: %s\n" %
+                self.ui.debug(_("request %d: %s\n") %
                             (reqcnt, " ".join(map(short, r))))
                 for p in range(0, len(r), 10):
                     for b in remote.branches(r[p:p+10]):
-                        self.ui.debug("received %s:%s\n" %
+                        self.ui.debug(_("received %s:%s\n") %
                                       (short(b[0]), short(b[1])))
                         if b[0] in m:
-                            self.ui.debug("found base node %s\n" % short(b[0]))
+                            self.ui.debug(_("found base node %s\n") % short(b[0]))
                             base[b[0]] = 1
                         elif b[0] not in seen:
                             unknown.append(b)
@@ -818,15 +818,15 @@
             p = n[0]
             f = 1
             for i in l:
-                self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
+                self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i)))
                 if i in m:
                     if f <= 2:
-                        self.ui.debug("found new branch changeset %s\n" %
+                        self.ui.debug(_("found new branch changeset %s\n") %
                                           short(p))
                         fetch[p] = 1
                         base[i] = 1
                     else:
-                        self.ui.debug("narrowed branch search to %s:%s\n"
+                        self.ui.debug(_("narrowed branch search to %s:%s\n")
                                       % (short(p), short(i)))
                         search.append((p, i))
                     break
@@ -835,15 +835,15 @@
         # sanity check our fetch list
         for f in fetch.keys():
             if f in m:
-                raise repo.RepoError("already have changeset " + short(f[:4]))
+                raise repo.RepoError(_("already have changeset ") + short(f[:4]))
 
         if base.keys() == [nullid]:
-            self.ui.warn("warning: pulling from an unrelated repository!\n")
+            self.ui.warn(_("warning: pulling from an unrelated repository!\n"))
 
-        self.ui.note("found new changesets starting at " +
+        self.ui.note(_("found new changesets starting at ") +
                      " ".join([short(f) for f in fetch]) + "\n")
 
-        self.ui.debug("%d total queries\n" % reqcnt)
+        self.ui.debug(_("%d total queries\n") % reqcnt)
 
         return fetch.keys()
 
@@ -852,7 +852,7 @@
             base = {}
             self.findincoming(remote, base, heads)
 
-        self.ui.debug("common changesets up to "
+        self.ui.debug(_("common changesets up to ")
                       + " ".join(map(short, base.keys())) + "\n")
 
         remain = dict.fromkeys(self.changelog.nodemap)
@@ -882,13 +882,13 @@
 
         # if we have an empty repo, fetch everything
         if self.changelog.tip() == nullid:
-            self.ui.status("requesting all changes\n")
+            self.ui.status(_("requesting all changes\n"))
             fetch = [nullid]
         else:
             fetch = self.findincoming(remote)
 
         if not fetch:
-            self.ui.status("no changes found\n")
+            self.ui.status(_("no changes found\n"))
             return 1
 
         cg = remote.changegroup(fetch)
@@ -901,19 +901,19 @@
         heads = remote.heads()
         inc = self.findincoming(remote, base, heads)
         if not force and inc:
-            self.ui.warn("abort: unsynced remote changes!\n")
-            self.ui.status("(did you forget to sync? use push -f to force)\n")
+            self.ui.warn(_("abort: unsynced remote changes!\n"))
+            self.ui.status(_("(did you forget to sync? use push -f to force)\n"))
             return 1
 
         update = self.findoutgoing(remote, base)
         if not update:
-            self.ui.status("no changes found\n")
+            self.ui.status(_("no changes found\n"))
             return 1
         elif not force:
             if len(heads) < len(self.changelog.heads()):
-                self.ui.warn("abort: push creates new remote branches!\n")
-                self.ui.status("(did you forget to merge?" +
-                               " use push -f to force)\n")
+                self.ui.warn(_("abort: push creates new remote branches!\n"))
+                self.ui.status(_("(did you forget to merge?"
+                                 " use push -f to force)\n"))
                 return 1
 
         cg = self.changegroup(update)
@@ -963,8 +963,8 @@
             if l <= 4: return ""
             d = source.read(l - 4)
             if len(d) < l - 4:
-                raise repo.RepoError("premature EOF reading chunk" +
-                                     " (got %d bytes, expected %d)"
+                raise repo.RepoError(_("premature EOF reading chunk"
+                                       " (got %d bytes, expected %d)")
                                      % (len(d), l - 4))
             return d
 
@@ -975,7 +975,7 @@
                 yield c
 
         def csmap(x):
-            self.ui.debug("add changeset %s\n" % short(x))
+            self.ui.debug(_("add changeset %s\n") % short(x))
             return self.changelog.count()
 
         def revmap(x):
@@ -989,7 +989,7 @@
         oldheads = len(self.changelog.heads())
 
         # pull off the changeset group
-        self.ui.status("adding changesets\n")
+        self.ui.status(_("adding changesets\n"))
         co = self.changelog.tip()
         cn = self.changelog.addgroup(getgroup(), csmap, tr, 1) # unique
         cnr, cor = map(self.changelog.rev, (cn, co))
@@ -998,16 +998,16 @@
         changesets = cnr - cor
 
         # pull off the manifest group
-        self.ui.status("adding manifests\n")
+        self.ui.status(_("adding manifests\n"))
         mm = self.manifest.tip()
         mo = self.manifest.addgroup(getgroup(), revmap, tr)
 
         # process the files
-        self.ui.status("adding file changes\n")
+        self.ui.status(_("adding file changes\n"))
         while 1:
             f = getchunk()
             if not f: break
-            self.ui.debug("adding %s revisions\n" % f)
+            self.ui.debug(_("adding %s revisions\n") % f)
             fl = self.file(f)
             o = fl.count()
             n = fl.addgroup(getgroup(), revmap, tr)
@@ -1017,18 +1017,18 @@
         newheads = len(self.changelog.heads())
         heads = ""
         if oldheads and newheads > oldheads:
-            heads = " (+%d heads)" % (newheads - oldheads)
+            heads = _(" (+%d heads)") % (newheads - oldheads)
 
-        self.ui.status(("added %d changesets" +
-                        " with %d changes to %d files%s\n")
-                       % (changesets, revisions, files, heads))
+        self.ui.status(_("added %d changesets"
+                         " with %d changes to %d files%s\n")
+                         % (changesets, revisions, files, heads))
 
         tr.close()
 
         if changesets > 0:
             if not self.hook("changegroup",
                               node=hex(self.changelog.node(cor+1))):
-                self.ui.warn("abort: changegroup hook returned failure!\n")
+                self.ui.warn(_("abort: changegroup hook returned failure!\n"))
                 return 1
 
             for i in range(cor + 1, cnr + 1):
@@ -1040,7 +1040,7 @@
                moddirstate=True):
         pl = self.dirstate.parents()
         if not force and pl[1] != nullid:
-            self.ui.warn("aborting: outstanding uncommitted merges\n")
+            self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
             return 1
 
         p1, p2 = pl[0], node
@@ -1063,10 +1063,10 @@
 
         # resolve the manifest to determine which files
         # we care about merging
-        self.ui.note("resolving manifests\n")
-        self.ui.debug(" force %s allow %s moddirstate %s linear %s\n" %
+        self.ui.note(_("resolving manifests\n"))
+        self.ui.debug(_(" force %s allow %s moddirstate %s linear %s\n") %
                       (force, allow, moddirstate, linear_path))
-        self.ui.debug(" ancestor %s local %s remote %s\n" %
+        self.ui.debug(_(" ancestor %s local %s remote %s\n") %
                       (short(man), short(m1n), short(m2n)))
 
         merge = {}
@@ -1112,7 +1112,7 @@
                     a = ma.get(f, nullid)
                     # are both different from the ancestor?
                     if n != a and m2[f] != a:
-                        self.ui.debug(" %s versions differ, resolve\n" % f)
+                        self.ui.debug(_(" %s versions differ, resolve\n") % f)
                         # merge executable bits
                         # "if we changed or they changed, change in merge"
                         a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
@@ -1123,7 +1123,7 @@
                     # is remote's version newer?
                     # or are we going back in time?
                     elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]):
-                        self.ui.debug(" remote %s is newer, get\n" % f)
+                        self.ui.debug(_(" remote %s is newer, get\n") % f)
                         get[f] = m2[f]
                         s = 1
                 elif f in umap:
@@ -1132,60 +1132,60 @@
 
                 if not s and mfw[f] != mf2[f]:
                     if force:
-                        self.ui.debug(" updating permissions for %s\n" % f)
+                        self.ui.debug(_(" updating permissions for %s\n") % f)
                         util.set_exec(self.wjoin(f), mf2[f])
                     else:
                         a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
                         mode = ((a^b) | (a^c)) ^ a
                         if mode != b:
-                            self.ui.debug(" updating permissions for %s\n" % f)
+                            self.ui.debug(_(" updating permissions for %s\n") % f)
                             util.set_exec(self.wjoin(f), mode)
                 del m2[f]
             elif f in ma:
                 if n != ma[f]:
-                    r = "d"
+                    r = _("d")
                     if not force and (linear_path or allow):
                         r = self.ui.prompt(
-                            (" local changed %s which remote deleted\n" % f) +
-                            "(k)eep or (d)elete?", "[kd]", "k")
-                    if r == "d":
+                            (_(" local changed %s which remote deleted\n") % f) +
+                             _("(k)eep or (d)elete?"), _("[kd]"), _("k"))
+                    if r == _("d"):
                         remove.append(f)
                 else:
-                    self.ui.debug("other deleted %s\n" % f)
+                    self.ui.debug(_("other deleted %s\n") % f)
                     remove.append(f) # other deleted it
             else:
                 # file is created on branch or in working directory
                 if force and f not in umap:
-                    self.ui.debug("remote deleted %s, clobbering\n" % f)
+                    self.ui.debug(_("remote deleted %s, clobbering\n") % f)
                     remove.append(f)
                 elif n == m1.get(f, nullid): # same as parent
                     if p2 == pa: # going backwards?
-                        self.ui.debug("remote deleted %s\n" % f)
+                        self.ui.debug(_("remote deleted %s\n") % f)
                         remove.append(f)
                     else:
-                        self.ui.debug("local modified %s, keeping\n" % f)
+                        self.ui.debug(_("local modified %s, keeping\n") % f)
                 else:
-                    self.ui.debug("working dir created %s, keeping\n" % f)
+                    self.ui.debug(_("working dir created %s, keeping\n") % f)
 
         for f, n in m2.iteritems():
             if choose and not choose(f): continue
             if f[0] == "/": continue
             if f in ma and n != ma[f]:
-                r = "k"
+                r = _("k")
                 if not force and (linear_path or allow):
                     r = self.ui.prompt(
-                        ("remote changed %s which local deleted\n" % f) +
-                        "(k)eep or (d)elete?", "[kd]", "k")
-                if r == "k": get[f] = n
+                        (_("remote changed %s which local deleted\n") % f) +
+                         _("(k)eep or (d)elete?"), _("[kd]"), _("k"))
+                if r == _("k"): get[f] = n
             elif f not in ma:
-                self.ui.debug("remote created %s\n" % f)
+                self.ui.debug(_("remote created %s\n") % f)
                 get[f] = n
             else:
                 if force or p2 == pa: # going backwards?
-                    self.ui.debug("local deleted %s, recreating\n" % f)
+                    self.ui.debug(_("local deleted %s, recreating\n") % f)
                     get[f] = n
                 else:
-                    self.ui.debug("local deleted %s\n" % f)
+                    self.ui.debug(_("local deleted %s\n") % f)
 
         del mw, m1, m2, ma
 
@@ -1200,17 +1200,17 @@
             p1, p2 = p2, nullid
         else:
             if not allow:
-                self.ui.status("this update spans a branch" +
-                               " affecting the following files:\n")
+                self.ui.status(_("this update spans a branch"
+                                 " affecting the following files:\n"))
                 fl = merge.keys() + get.keys()
                 fl.sort()
                 for f in fl:
                     cf = ""
-                    if f in merge: cf = " (resolve)"
+                    if f in merge: cf = _(" (resolve)")
                     self.ui.status(" %s%s\n" % (f, cf))
-                self.ui.warn("aborting update spanning branches!\n")
-                self.ui.status("(use update -m to merge across branches" +
-                               " or -C to lose changes)\n")
+                self.ui.warn(_("aborting update spanning branches!\n"))
+                self.ui.status(_("(use update -m to merge across branches"
+                                 " or -C to lose changes)\n"))
                 return 1
             branch_merge = True
 
@@ -1222,7 +1222,7 @@
         files.sort()
         for f in files:
             if f[0] == "/": continue
-            self.ui.note("getting %s\n" % f)
+            self.ui.note(_("getting %s\n") % f)
             t = self.file(f).read(get[f])
             try:
                 self.wwrite(f, t)
@@ -1242,7 +1242,7 @@
         files = merge.keys()
         files.sort()
         for f in files:
-            self.ui.status("merging %s\n" % f)
+            self.ui.status(_("merging %s\n") % f)
             my, other, flag = merge[f]
             self.merge3(f, my, other)
             util.set_exec(self.wjoin(f), flag)
@@ -1262,12 +1262,12 @@
 
         remove.sort()
         for f in remove:
-            self.ui.note("removing %s\n" % f)
+            self.ui.note(_("removing %s\n") % f)
             try:
                 os.unlink(self.wjoin(f))
             except OSError, inst:
                 if inst.errno != errno.ENOENT:
-                    self.ui.warn("update failed to remove %s: %s!\n" %
+                    self.ui.warn(_("update failed to remove %s: %s!\n") %
                                  (f, inst.strerror))
             # try removing directories that might now be empty
             try: os.removedirs(os.path.dirname(self.wjoin(f)))
@@ -1295,15 +1295,15 @@
         b = temp("base", base)
         c = temp("other", other)
 
-        self.ui.note("resolving %s\n" % fn)
-        self.ui.debug("file %s: my %s other %s ancestor %s\n" %
+        self.ui.note(_("resolving %s\n") % fn)
+        self.ui.debug(_("file %s: my %s other %s ancestor %s\n") %
                               (fn, short(my), short(other), short(base)))
 
         cmd = (os.environ.get("HGMERGE") or self.ui.config("ui", "merge")
                or "hgmerge")
         r = os.system("%s %s %s %s" % (cmd, a, b, c))
         if r:
-            self.ui.warn("merging %s failed!\n" % fn)
+            self.ui.warn(_("merging %s failed!\n") % fn)
 
         os.unlink(b)
         os.unlink(c)
@@ -1320,25 +1320,25 @@
             errors[0] += 1
 
         seen = {}
-        self.ui.status("checking changesets\n")
+        self.ui.status(_("checking changesets\n"))
         for i in range(self.changelog.count()):
             changesets += 1
             n = self.changelog.node(i)
             l = self.changelog.linkrev(n)
             if l != i:
-                err("incorrect link (%d) for changeset revision %d" % (l, i))
+                err(_("incorrect link (%d) for changeset revision %d") %(l, i))
             if n in seen:
-                err("duplicate changeset at revision %d" % i)
+                err(_("duplicate changeset at revision %d") % i)
             seen[n] = 1
 
             for p in self.changelog.parents(n):
                 if p not in self.changelog.nodemap:
-                    err("changeset %s has unknown parent %s" %
+                    err(_("changeset %s has unknown parent %s") %
                                  (short(n), short(p)))
             try:
                 changes = self.changelog.read(n)
             except Exception, inst:
-                err("unpacking changeset %s: %s" % (short(n), inst))
+                err(_("unpacking changeset %s: %s") % (short(n), inst))
 
             neededmanifests[changes[0]] = n
 
@@ -1346,55 +1346,55 @@
                 filelinkrevs.setdefault(f, []).append(i)
 
         seen = {}
-        self.ui.status("checking manifests\n")
+        self.ui.status(_("checking manifests\n"))
         for i in range(self.manifest.count()):
             n = self.manifest.node(i)
             l = self.manifest.linkrev(n)
 
             if l < 0 or l >= self.changelog.count():
-                err("bad manifest link (%d) at revision %d" % (l, i))
+                err(_("bad manifest link (%d) at revision %d") % (l, i))
 
             if n in neededmanifests:
                 del neededmanifests[n]
 
             if n in seen:
-                err("duplicate manifest at revision %d" % i)
+                err(_("duplicate manifest at revision %d") % i)
 
             seen[n] = 1
 
             for p in self.manifest.parents(n):
                 if p not in self.manifest.nodemap:
-                    err("manifest %s has unknown parent %s" %
+                    err(_("manifest %s has unknown parent %s") %
                         (short(n), short(p)))
 
             try:
                 delta = mdiff.patchtext(self.manifest.delta(n))
             except KeyboardInterrupt:
-                self.ui.warn("interrupted")
+                self.ui.warn(_("interrupted"))
                 raise
             except Exception, inst:
-                err("unpacking manifest %s: %s" % (short(n), inst))
+                err(_("unpacking manifest %s: %s") % (short(n), inst))
 
             ff = [ l.split('\0') for l in delta.splitlines() ]
             for f, fn in ff:
                 filenodes.setdefault(f, {})[bin(fn[:40])] = 1
 
-        self.ui.status("crosschecking files in changesets and manifests\n")
+        self.ui.status(_("crosschecking files in changesets and manifests\n"))
 
         for m,c in neededmanifests.items():
-            err("Changeset %s refers to unknown manifest %s" %
+            err(_("Changeset %s refers to unknown manifest %s") %
                 (short(m), short(c)))
         del neededmanifests
 
         for f in filenodes:
             if f not in filelinkrevs:
-                err("file %s in manifest but not in changesets" % f)
+                err(_("file %s in manifest but not in changesets") % f)
 
         for f in filelinkrevs:
             if f not in filenodes:
-                err("file %s in changeset but not in manifest" % f)
+                err(_("file %s in changeset but not in manifest") % f)
 
-        self.ui.status("checking files\n")
+        self.ui.status(_("checking files\n"))
         ff = filenodes.keys()
         ff.sort()
         for f in ff:
@@ -1408,15 +1408,15 @@
                 n = fl.node(i)
 
                 if n in seen:
-                    err("%s: duplicate revision %d" % (f, i))
+                    err(_("%s: duplicate revision %d") % (f, i))
                 if n not in filenodes[f]:
-                    err("%s: %d:%s not in manifests" % (f, i, short(n)))
+                    err(_("%s: %d:%s not in manifests") % (f, i, short(n)))
                 else:
                     del filenodes[f][n]
 
                 flr = fl.linkrev(n)
                 if flr not in filelinkrevs[f]:
-                    err("%s:%s points to unexpected changeset %d"
+                    err(_("%s:%s points to unexpected changeset %d")
                             % (f, short(n), flr))
                 else:
                     filelinkrevs[f].remove(flr)
@@ -1425,25 +1425,25 @@
                 try:
                     t = fl.read(n)
                 except Exception, inst:
-                    err("unpacking file %s %s: %s" % (f, short(n), inst))
+                    err(_("unpacking file %s %s: %s") % (f, short(n), inst))
 
                 # verify parents
                 (p1, p2) = fl.parents(n)
                 if p1 not in nodes:
-                    err("file %s:%s unknown parent 1 %s" %
+                    err(_("file %s:%s unknown parent 1 %s") %
                         (f, short(n), short(p1)))
                 if p2 not in nodes:
-                    err("file %s:%s unknown parent 2 %s" %
+                    err(_("file %s:%s unknown parent 2 %s") %
                             (f, short(n), short(p1)))
                 nodes[n] = 1
 
             # cross-check
             for node in filenodes[f]:
-                err("node %s in manifests not in %s" % (hex(node), f))
+                err(_("node %s in manifests not in %s") % (hex(node), f))
 
-        self.ui.status("%d files, %d changesets, %d total revisions\n" %
+        self.ui.status(_("%d files, %d changesets, %d total revisions\n") %
                        (files, changesets, revisions))
 
         if errors[0]:
-            self.ui.warn("%d integrity errors encountered!\n" % errors[0])
+            self.ui.warn(_("%d integrity errors encountered!\n") % errors[0])
             return 1
--- a/mercurial/manifest.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/manifest.py	Tue Oct 18 18:38:39 2005 -0700
@@ -44,7 +44,7 @@
         if self.listcache and self.addlist and self.listcache[0] == a:
             d = mdiff.diff(self.listcache[1], self.addlist, 1)
             if mdiff.patch(a, d) != b:
-                raise AssertionError("sortdiff failed!")
+                raise AssertionError(_("sortdiff failed!"))
             return d
         else:
             return mdiff.textdiff(a, b)
@@ -145,7 +145,7 @@
                     end = bs
                     if w[1] == 1:
                         raise AssertionError(
-                            "failed to remove %s from manifest\n" % f)
+                            _("failed to remove %s from manifest\n") % f)
                 else:
                     # item is found, replace/delete the existing line
                     end = bs + 1
@@ -159,7 +159,7 @@
 
         text = "".join(self.addlist)
         if cachedelta and mdiff.patch(self.listcache[0], cachedelta) != text:
-            raise AssertionError("manifest delta failure\n")
+            raise AssertionError(_("manifest delta failure\n"))
         n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
         self.mapcache = (n, map, flags)
         self.listcache = (text, self.addlist)
--- a/mercurial/revlog.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/revlog.py	Tue Oct 18 18:38:39 2005 -0700
@@ -48,7 +48,7 @@
     if t == '\0': return bin
     if t == 'x': return zlib.decompress(bin)
     if t == 'u': return bin[1:]
-    raise RevlogError("unknown compression type %s" % t)
+    raise RevlogError(_("unknown compression type %s") % t)
 
 indexformat = ">4l20s20s20s"
 
@@ -214,7 +214,7 @@
         try:
             return self.nodemap[node]
         except KeyError:
-            raise RevlogError('%s: no node %s' % (self.indexfile, hex(node)))
+            raise RevlogError(_('%s: no node %s') % (self.indexfile, hex(node)))
     def linkrev(self, node): return self.index[self.rev(node)][3]
     def parents(self, node):
         if node == nullid: return (nullid, nullid)
@@ -294,8 +294,8 @@
             for n in self.nodemap:
                 if hex(n).startswith(id):
                     c.append(n)
-            if len(c) > 1: raise RevlogError("Ambiguous identifier")
-            if len(c) < 1: raise RevlogError("No match found")
+            if len(c) > 1: raise RevlogError(_("Ambiguous identifier"))
+            if len(c) < 1: raise RevlogError(_("No match found"))
             return c[0]
 
         return None
@@ -357,7 +357,7 @@
         text = mdiff.patches(text, bins)
 
         if node != hash(text, p1, p2):
-            raise RevlogError("integrity check failed on %s:%d"
+            raise RevlogError(_("integrity check failed on %s:%d")
                           % (self.datafile, rev))
 
         self.cache = (node, rev, text)
@@ -629,7 +629,7 @@
             if node in self.nodemap:
                 # this can happen if two branches make the same change
                 # if unique:
-                #    raise RevlogError("already have %s" % hex(node[:4]))
+                #    raise RevlogError(_("already have %s") % hex(node[:4]))
                 chain = node
                 continue
             delta = chunk[80:]
@@ -638,7 +638,7 @@
                 # retrieve the parent revision of the delta chain
                 chain = p1
                 if not chain in self.nodemap:
-                    raise RevlogError("unknown base %s" % short(chain[:4]))
+                    raise RevlogError(_("unknown base %s") % short(chain[:4]))
 
             # full versions are inserted when the needed deltas become
             # comparable to the uncompressed text or when the previous
@@ -657,7 +657,7 @@
                 text = self.patches(text, [delta])
                 chk = self.addrevision(text, transaction, link, p1, p2)
                 if chk != node:
-                    raise RevlogError("consistency error adding group")
+                    raise RevlogError(_("consistency error adding group"))
                 measure = len(text)
             else:
                 e = (end, len(cdelta), self.base(t), link, p1, p2, node)
--- a/mercurial/sshrepo.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/sshrepo.py	Tue Oct 18 18:38:39 2005 -0700
@@ -18,7 +18,7 @@
 
         m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
         if not m:
-            raise hg.RepoError("couldn't parse destination %s" % path)
+            raise hg.RepoError(_("couldn't parse destination %s") % path)
 
         self.user = m.group(2)
         self.host = m.group(3)
@@ -42,7 +42,7 @@
             if size == 0: break
             l = self.pipee.readline()
             if not l: break
-            self.ui.status("remote: ", l)
+            self.ui.status(_("remote: "), l)
 
     def __del__(self):
         try:
@@ -50,7 +50,7 @@
             self.pipei.close()
             # read the error descriptor until EOF
             for l in self.pipee:
-                self.ui.status("remote: ", l)
+                self.ui.status(_("remote: "), l)
             self.pipee.close()
         except:
             pass
@@ -59,7 +59,7 @@
         return -1
 
     def do_cmd(self, cmd, **args):
-        self.ui.debug("sending %s command\n" % cmd)
+        self.ui.debug(_("sending %s command\n") % cmd)
         self.pipeo.write("%s\n" % cmd)
         for k, v in args.items():
             self.pipeo.write("%s %d\n" % (k, len(v)))
@@ -75,7 +75,7 @@
         try:
             l = int(l)
         except:
-            raise hg.RepoError("unexpected response '%s'" % l)
+            raise hg.RepoError(_("unexpected response '%s'") % l)
         return r.read(l)
 
     def lock(self):
@@ -90,7 +90,7 @@
         try:
             return map(bin, d[:-1].split(" "))
         except:
-            raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
+            raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
 
     def branches(self, nodes):
         n = " ".join(map(hex, nodes))
@@ -99,7 +99,7 @@
             br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
             return br
         except:
-            raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
+            raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
 
     def between(self, pairs):
         n = "\n".join(["-".join(map(hex, p)) for p in pairs])
@@ -108,7 +108,7 @@
             p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
             return p
         except:
-            raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
+            raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
 
     def changegroup(self, nodes):
         n = " ".join(map(hex, nodes))
@@ -118,7 +118,7 @@
     def addchangegroup(self, cg):
         d = self.call("addchangegroup")
         if d:
-            raise hg.RepoError("push refused: %s", d)
+            raise hg.RepoError(_("push refused: %s"), d)
 
         while 1:
             d = cg.read(4096)
--- a/mercurial/transaction.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/transaction.py	Tue Oct 18 18:38:39 2005 -0700
@@ -21,7 +21,7 @@
 
         # abort here if the journal already exists
         if os.path.exists(journal):
-            raise AssertionError("journal already exists - run hg recover")
+            raise AssertionError(_("journal already exists - run hg recover"))
 
         self.report = report
         self.opener = opener
@@ -59,17 +59,17 @@
     def abort(self):
         if not self.entries: return
 
-        self.report("transaction abort!\n")
+        self.report(_("transaction abort!\n"))
 
         for f, o in self.entries:
             try:
                 self.opener(f, "a").truncate(o)
             except:
-                self.report("failed to truncate %s\n" % f)
+                self.report(_("failed to truncate %s\n") % f)
 
         self.entries = []
 
-        self.report("rollback completed\n")
+        self.report(_("rollback completed\n"))
 
 def rollback(opener, file):
     for l in open(file).readlines():
--- a/mercurial/ui.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/ui.py	Tue Oct 18 18:38:39 2005 -0700
@@ -115,7 +115,7 @@
             if re.match(pat, r):
                 return r
             else:
-                self.write("unrecognized response\n")
+                self.write(_("unrecognized response\n"))
     def status(self, *msg):
         if not self.quiet: self.write(*msg)
     def warn(self, *msg):
@@ -136,7 +136,7 @@
                   os.environ.get("EDITOR", "vi"))
 
         os.environ["HGUSER"] = self.username()
-        util.system("%s %s" % (editor, name), errprefix="edit failed")
+        util.system("%s %s" % (editor, name), errprefix=_("edit failed"))
 
         t = open(name).read()
         t = re.sub("(?m)^HG:.*\n", "", t)
--- a/mercurial/util.py	Tue Oct 18 18:38:04 2005 -0700
+++ b/mercurial/util.py	Tue Oct 18 18:38:39 2005 -0700
@@ -47,7 +47,7 @@
         cmd = cmd.replace('INFILE', inname)
         cmd = cmd.replace('OUTFILE', outname)
         code = os.system(cmd)
-        if code: raise Abort("command '%s' failed: %s" %
+        if code: raise Abort(_("command '%s' failed: %s") %
                              (cmd, explain_exit(code)))
         return open(outname, 'rb').read()
     finally:
@@ -83,7 +83,7 @@
             files.setdefault(pf, 1)
     code = fp.close()
     if code:
-        raise Abort("patch command failed: %s" % explain_exit(code)[0])
+        raise Abort(_("patch command failed: %s") % explain_exit(code)[0])
     return files.keys()
 
 def binary(s):
@@ -366,7 +366,7 @@
     os_link = os.link
 else:
     def os_link(src, dst):
-        raise OSError(0, "Hardlinks not supported")
+        raise OSError(0, _("Hardlinks not supported"))
 
 # Platform specific variants
 if os.name == 'nt':
@@ -431,7 +431,7 @@
     readlock = _readlock_file
 
     def explain_exit(code):
-        return "exited with status %d" % code, code
+        return _("exited with status %d") % code, code
 
 else:
     nulldev = '/dev/null'
@@ -494,14 +494,14 @@
         """return a 2-tuple (desc, code) describing a process's status"""
         if os.WIFEXITED(code):
             val = os.WEXITSTATUS(code)
-            return "exited with status %d" % val, val
+            return _("exited with status %d") % val, val
         elif os.WIFSIGNALED(code):
             val = os.WTERMSIG(code)
-            return "killed by signal %d" % val, val
+            return _("killed by signal %d") % val, val
         elif os.WIFSTOPPED(code):
             val = os.WSTOPSIG(code)
-            return "stopped by signal %d" % val, val
-        raise ValueError("invalid exit code")
+            return _("stopped by signal %d") % val, val
+        raise ValueError(_("invalid exit code"))
 
 class chunkbuffer(object):
     """Allow arbitrary sized chunks of data to be efficiently read from an
@@ -514,7 +514,7 @@
         self.buf = ''
         self.targetsize = int(targetsize)
         if self.targetsize <= 0:
-            raise ValueError("targetsize must be greater than 0, was %d" %
+            raise ValueError(_("targetsize must be greater than 0, was %d") %
                              targetsize)
         self.iterempty = False