[PATCH 3 of 8] crecord: filter text via i18n

Jun Wu quark at fb.com
Wed Nov 23 18:24:38 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1479924791 0
#      Wed Nov 23 18:13:11 2016 +0000
# Node ID ed629f77d3616013c8216d99e90e02c47eccdb4f
# Parent  d4c7651935165820d8bfe363c8cae95e0192af1f
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r ed629f77d361
crecord: filter text via i18n

There are some text in the user interface that are not filtered by i18n.
This patch adds the missing "_" call. So the text could be translated.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -961,8 +961,8 @@ class curseschunkselector(object):
                 self.statuswin.refresh()
                 return
-            line1 = ("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
-                   "(space/A) toggle hunk/all; (e)dit hunk;")
-            line2 = (" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
-                   "| [X]=hunk applied **=folded, toggle [a]mend mode")
+            line1 = _("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
+                      "(space/A) toggle hunk/all; (e)dit hunk;")
+            line2 = _(" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
+                      "| [X]=hunk applied **=folded, toggle [a]mend mode")
 
             printstring(self.statuswin,
@@ -1306,5 +1306,6 @@ class curseschunkselector(object):
     def helpwindow(self):
         "print a help window to the screen.  exit after any keypress."
-        helptext = """            [press any key to return to the patch-display]
+        helptext = _(
+            """            [press any key to return to the patch-display]
 
 crecord allows you to interactively choose among the changes you have made,
@@ -1330,5 +1331,5 @@ the following are valid keystrokes:
                       r : review/edit and confirm selected changes
                       q : quit without confirming (no changes will be made)
-                      ? : help (what you're currently reading)"""
+                      ? : help (what you're currently reading)""")
 
         helpwin = curses.newwin(self.yscreensize, 0, 0, 0)
@@ -1369,5 +1370,5 @@ the following are valid keystrokes:
         """ask for 'y' to be pressed to confirm selected. return True if
         confirmed."""
-        confirmtext = (
+        confirmtext = _(
 """if you answer yes to the following, the your currently chosen patch chunks
 will be loaded into an editor.  you may modify the patch from the editor, and
@@ -1401,17 +1402,17 @@ are you sure you want to review/edit and
             ver = 1
         if ver < 2.19:
-            msg = ("The amend option is unavailable with hg versions < 2.2\n\n"
-                   "Press any key to continue.")
+            msg = _("The amend option is unavailable with hg versions < 2.2\n\n"
+                    "Press any key to continue.")
         elif opts.get('amend') is None:
             opts['amend'] = True
-            msg = ("Amend option is turned on -- committing the currently "
-                   "selected changes will not create a new changeset, but "
-                   "instead update the most recently committed changeset.\n\n"
-                   "Press any key to continue.")
+            msg = _("Amend option is turned on -- committing the currently "
+                    "selected changes will not create a new changeset, but "
+                    "instead update the most recently committed changeset.\n\n"
+                    "Press any key to continue.")
         elif opts.get('amend') is True:
             opts['amend'] = None
-            msg = ("Amend option is turned off -- committing the currently "
-                   "selected changes will create a new changeset.\n\n"
-                   "Press any key to continue.")
+            msg = _("Amend option is turned off -- committing the currently "
+                    "selected changes will create a new changeset.\n\n"
+                    "Press any key to continue.")
         if not test:
             self.confirmationwindow(msg)


More information about the Mercurial-devel mailing list