Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 878969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:51:09+00:00 2026-05-15T11:51:09+00:00

In Mercurial, many of the extensions wrap their help/syntax string in a call to

  • 0

In Mercurial, many of the extensions wrap their help/syntax string in a call to an underscore function, like so:

 _('[OPTION] [QUEUE]')

This confuses me, because it does not seem necessary (the Writing Extensions instructions don’t mention it) and there doesn’t seem to be a _ defined in the class, so I’m wondering if this is some special syntax that I don’t understand, perhaps another way to say lambda, or maybe the identity function? Additionally I’m wondering what the benefit of this methodology (whatever it is) is over just the raw string like the documentation suggests.

Nothing I’ve seen in the Python documentation mentions such a function, so I’m not sure if this is really a Python question, or a Mercurial question.

Here are two examples that use this structure (look at the cmdtable dictionary near the bottom of the file)

  • https://www.mercurial-scm.org/repo/hg/file/42408cd43f55/hgext/mq.py
  • https://www.mercurial-scm.org/repo/hg/file/42408cd43f55/hgext/graphlog.py
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:51:10+00:00Added an answer on May 15, 2026 at 11:51 am

    Look on line 45:

    from mercurial.i18n import _
    

    This is the usual abbreviation in the internationalization package gettext, and possibly other packages too, for the function that returns a translation of its argument to the language the program is currently running in. It’s abbreviated to _ for convenience, since it’s used for just about every message displayed to the user.

    Looks like Mercurial wraps it in their own module. (“i18n” stands for “internationalization” because there are 18 letters in between “i” and “n”.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Mercurial offer any type of extensions that offer functionality similar to TFS's work
I'm a new mac user and recently installed mercurial on it. Id like to
I am serving up access to many mercurial repositories using hgweb, providing them as
I have written a command-line tool that uses sub-commands much like Mercurial, Git, Subversion
Is it possible to backup a filesystem with many Mercurial repositories (e.g., with rsync
I have been running mercurial (on Windows) for many months and I am suddenly
I can see why distributed source control systems (DVCS - like Mercurial) make sense
I've heard that many of the distributed VCSs (git, mercurial, etc) are better at
I have an svn repo, and I'd like to use Mercurial as a front-end
I would like to configure Mercurial to be able to do something like hg

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.