Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall uname output: Linux rocket76 3.2.0-55-generic #85-Ubuntu SMP Wed Oct 2 12:29:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.2 Patch Level: 25 Release Status: release Description: TEXTDOMAIN must be defined before TEXTDOMAINDIR - otherwise it does not work. Use of $"text" in functions does not work if TEXTDOMAIN{,DIR} is defined below the defined function - regardless of application flow. Repeat-By: #!/bin/bash l1="/tmp/test/de/LC_MESSAGES" # adjust according to your needs l2="/tmp/test" # short form of above mkdir -p $l1 echo -e 'msgid "failed"\nmsgstr "worked"' | msgfmt -o $l1/test.mo - echo test1 export TEXTDOMAINDIR=$l2 export TEXTDOMAIN=test f() { echo ' '$"failed" } echo ' '$"failed" f echo test2 unset TEXTDOMAINDIR TEXTDOMAIN export TEXTDOMAIN=test export TEXTDOMAINDIR=$l2 echo ' '$"failed" f echo test3 unset f f() { echo ' '$"failed" } echo ' '$"failed" f Fix: You must set TEXTDOMAIN before TEXTDOMAINDIR (bug?!) You must set TEXTDOMAIN{,DIR} above the function (unexpexted for me)