[pacman-dev] [RFC v3 13/13] bacman: make gettext useful
Allan McRae
allan at archlinux.org
Sat Oct 1 07:41:51 UTC 2016
On 30/09/16 22:14, Dave Reisner wrote:
> On Fri, Sep 30, 2016 at 01:48:01PM +0200, Gordian Edenhofer wrote:
>> Export TEXTDOMAIN and TEXTDOMAINDIR in order for the strings to be
>> translatable with gettext.
>> ---
>> contrib/bacman.sh.in | 28 ++++++++++++++++++++++------
>> 1 file changed, 22 insertions(+), 6 deletions(-)
>>
>> diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
>> index 39fbe99..cc243c9 100644
>> --- a/contrib/bacman.sh.in
>> +++ b/contrib/bacman.sh.in
>> @@ -32,6 +32,17 @@ QUIET=0
>> # Required for fakeroot because options are shifted off the array.
>> ARGS=("$@")
>>
>> +# gettext initialization
>> +export TEXTDOMAIN='pacman'
>> +export TEXTDOMAINDIR='@localedir@'
>> +
>> +# Determine whether we have gettext; make it a no-op if we do not
>> +if ! type -p gettext >/dev/null; then
>> + gettext() {
>> + printf "%s\n" "$@"
>
> Not sure if this is copypasted from somewhere, but it's wrong. Consider
> the output of:
>
> printf '%s\n' 1 2 3
>
> vs.
>
> printf '%s\n' '1 2 3'
>
> You probably wanted this to be: printf '%s\n' "$*"
>
Just because I am being dumb... Can someone explain the issue here:
# foo1() { printf "%s\n" "$@"; }
# foo2() { printf "%s\n" "$*"; }
# foo1 "test string"
test string
# foo2 "test string"
test string
I don't see a difference.
Allan
More information about the pacman-dev
mailing list