Patchwork [STABLE] translations: change label integer error to not specify the kind of label

login
register
mail settings
Submitter Durham Goode
Date April 19, 2013, 6:31 p.m.
Message ID <106ebba7e5b269b84511.1366396288@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1455/
State Superseded
Commit 290a61833b991b7c368bac6729d718f20440a6a3
Headers show

Comments

Durham Goode - April 19, 2013, 6:31 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1366394111 25200
#      Fri Apr 19 10:55:11 2013 -0700
# Branch stable
# Node ID 106ebba7e5b269b84511896fb9ba3ffcc9b79969
# Parent  96e9081e968b833c64a8da735e755f0d37750f8d
translations: change label integer error to not specify the kind of label

The current error message used the kind (bookmark, branch, tag) in the message.
Unfortunately this isn't easily translatable since some languages give different
genders to these words. The fix is to not specify it at all, since it should be
implicit based on the command the user just ran.

Relevant discussions around this area:
http://selenic.com/pipermail/mercurial-devel/2012-October/045567.html
http://selenic.com/pipermail/mercurial-devel/2012-October/045600.html

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -41,6 +41,8 @@ 
         ui.status(_("no changes found\n"))
 
 def checknewlabel(repo, lbl, kind):
+    # Do not use the "kind" parameter in ui output.
+    # It makes strings difficult to translate.
     if lbl in ['tip', '.', 'null']:
         raise util.Abort(_("the name '%s' is reserved") % lbl)
     for c in (':', '\0', '\n', '\r'):
@@ -48,7 +50,7 @@ 
             raise util.Abort(_("%r cannot be used in a name") % c)
     try:
         int(lbl)
-        raise util.Abort(_("a %s cannot have an integer as its name") % kind)
+        raise util.Abort(_("cannot use an integer as a label"))
     except ValueError:
         pass
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -260,7 +260,7 @@ 
 bookmark with integer name
 
   $ hg bookmark 10
-  abort: a bookmark cannot have an integer as its name
+  abort: cannot use an integer as a label
   [255]
 
 incompatible options