help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use $"msgid"?


From: Jesse Hathaway
Subject: Re: How to use $"msgid"?
Date: Tue, 23 Mar 2021 09:14:56 -0500

On Tue, Mar 23, 2021 at 8:45 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> Could anybody provide an example to show how to use it? Thanks.

There is a little more info in the manual:

  A double-quoted string preceded by a dollar sign ($"string") will cause
  the  string to be translated according to the current locale.  The get-
  text infrastructure performs the message catalog  lookup  and  transla-
  tion,  using  the  LC_MESSAGES  and TEXTDOMAIN shell variables.  If the
  current locale is C or POSIX, or if there are  no  translations  avail-
  able,  the dollar sign is ignored.  If the string is translated and re-
  placed, the replacement is double-quoted.

This stack overflow snippet shows the basic usage:
https://stackoverflow.com/a/29358585/1236063

  LANG=foo_BAR.utf8
  TEXTDOMAIN="test"
  TEXTDOMAINDIR="/usr/share/locale"
  echo $"fooMsgid"
  # bash --dump-po-strings <scriptfile>

This linux journal article details creating the translation files:

https://www.linuxjournal.com/content/internationalizing-those-bash-scripts



reply via email to

[Prev in Thread] Current Thread [Next in Thread]