[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use $"msgid"?
From: |
Greg Wooledge |
Subject: |
Re: How to use $"msgid"? |
Date: |
Tue, 23 Mar 2021 10:24:52 -0400 |
On Tue, Mar 23, 2021 at 09:14:56AM -0500, Jesse Hathaway wrote:
> 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
There's also <https://mywiki.wooledge.org/BashFAQ/098>. Take note of
the security warnings.