[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext feature request
From: |
felix |
Subject: |
Re: gettext feature request |
Date: |
Wed, 28 Jul 2021 10:38:32 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Jul 27, 2021 at 10:44:09PM +0200, Jean-Jacques Brucker wrote:
>
> I like what you wrote 12 years ago (
> https://lists.gnu.org/archive/html/bug-bash/2009-02/msg00258.html ). IMHO,
> it could have change some people's mind about bash, and could have saved
> developer energy.
>
>
> > $'...' already exists, so you can't use that for localization.
>
I've done a little job around *localization*, approx 8 years ago:
bash localization won't work with multilines strings (with strong
syntax or through `eval`)
https://stackoverflow.com/a/14147336/1765658
There are some interesting *works around*!
My last function is not perfect, but work on most cases:
f() {
local store=false OPTIND OPTARG OPTERR varname
while getopts 'd:v:' opt ;do
case $opt in
d ) local TEXTDOMAIN=$OPTARG ;;
v ) varname=$OPTARG ;;
esac
done
shift $((OPTIND-1))
eval 'local msg=$"'"${1//[\"\$\`]}"\"
shift
printf ${varname+-v} $varname "$msg" "$@"
}
f -d libc -v string "Permission denied"
echo $string
Keine Berechtigung
f -d coreutils $'Written by %s, %s, %s,\nand %s.\n' Huey Dewey Louie Georges
Geschrieben von Huey, Dewey, Louie
und Georges.
--
Félix Hauri - <felix@f-hauri.ch> - http://www.f-hauri.ch
- Re: gettext feature request, (continued)
- Re: gettext feature request, Jean-Jacques Brucker, 2021/07/24
- Re: gettext feature request, Chet Ramey, 2021/07/27
- Re: gettext feature request, Jean-Jacques Brucker, 2021/07/27
- Re: gettext feature request, Chet Ramey, 2021/07/29
- Re: gettext feature request, Jean-Jacques Brucker, 2021/07/31
- Re: gettext feature request, Lawrence Velázquez, 2021/07/31
Re: gettext feature request, Léa Gris, 2021/07/24
Re: gettext feature request, Eli Schwartz, 2021/07/29
Re: gettext feature request, Jean-Jacques Brucker, 2021/07/27
- Re: gettext feature request,
felix <=
Re: gettext feature request, Jean-Jacques Brucker, 2021/07/29