[pacman-dev] [PATCH 00/11] Streamline syntax of contrib scripts
Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options. Gordian Edenhofer (11): checkupdates: streamline usage function paccache: streamline usage function pacdiff: streamline usage function pacdiff: proper option handling pacdiff: streamline option syntax with makepkg paclist: streamline usage function paclog-pkglist: streamline usage function pacscripts: streamline usage function updpkgsums: streamline usage function rankmirrors: streamline usage function rankmirrors: proper option handling contrib/checkupdates.sh.in | 9 +-- contrib/paccache.sh.in | 61 ++++++++++---------- contrib/pacdiff.sh.in | 76 +++++++++++++++---------- contrib/paclist.sh.in | 10 ++-- contrib/paclog-pkglist.sh.in | 12 ++-- contrib/pacscripts.sh.in | 18 +++--- contrib/rankmirrors.sh.in | 132 +++++++++++++++++++++---------------------- contrib/updpkgsums.sh.in | 21 ++++--- 8 files changed, 179 insertions(+), 160 deletions(-) -- 2.10.0
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
Allow for '-m' as abbreviation for '--nocolor'.
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
On Sep 29, 2016 06:23, "Gordian Edenhofer"
On Thu, 2016-09-29 at 20:40 +1000, Dave Reisner wrote:
On Sep 29, 2016 06:23, "Gordian Edenhofer"
wrote: Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
None of your changes which add gettext support are useful in their current form as you do not export TEXTDOMAIN or TEXTDOMAINDIR.
Thanks for the hint! I forgot about that. Btw. paclist [1] already defined it. [1] https://git.archlinux.org/pacman.git/tree/contrib/paclist.sh.in#n23
On 29/09/16 21:25, Gordian Edenhofer wrote:
On Thu, 2016-09-29 at 20:40 +1000, Dave Reisner wrote:
On Sep 29, 2016 06:23, "Gordian Edenhofer"
wrote: Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
None of your changes which add gettext support are useful in their current form as you do not export TEXTDOMAIN or TEXTDOMAINDIR.
Thanks for the hint! I forgot about that. Btw. paclist [1] already defined it.
[1] https://git.archlinux.org/pacman.git/tree/contrib/paclist.sh.in#n23
It only works for paclist because it uses translations already provided by pacman. This will not work for anything else because strings from the contrib files are not added to the pacman translation. A new translation domain for contrib needs set-up if this is to work. A
On Thu, 2016-09-29 at 21:39 +1000, Allan McRae wrote:
On 29/09/16 21:25, Gordian Edenhofer wrote:
On Thu, 2016-09-29 at 20:40 +1000, Dave Reisner wrote:
On Sep 29, 2016 06:23, "Gordian Edenhofer"
wrote: Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
None of your changes which add gettext support are useful in their current form as you do not export TEXTDOMAIN or TEXTDOMAINDIR.
Thanks for the hint! I forgot about that. Btw. paclist [1] already defined it.
[1] https://git.archlinux.org/pacman.git/tree/contrib/paclist.sh.in #n23
It only works for paclist because it uses translations already provided by pacman. This will not work for anything else because strings from the contrib files are not added to the pacman translation.
A new translation domain for contrib needs set-up if this is to work.
Thanks for the explanation. To be honest I don't know how to setup a translation domain since I haven't read any documentation about this matter yet. I would appreciate if anybody could help me with this. Until then I will resumbit this patch as RFC once more and order commits according to whether they touch usage. An alternative approach would be to strip all gettext invocations and simply not make contrib script translatable.
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
Allow for '-m' as abbreviation for '--nocolor'.
Signed-off-by: Gordian Edenhofer
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Export TEXTDOMAIN and TEXTDOMAINDIR in order for the strings to be translatable with gettext. --- contrib/bacman.sh.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in index 39fbe99..cce5a1e 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" "$@" + } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh) -- 2.10.0
On Thu, Sep 29, 2016 at 12:23:00PM +0200, Gordian Edenhofer wrote:
Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
Again, you're still putting flag names in the translatable strings. This will only ever end badly.
Gordian Edenhofer (11): checkupdates: streamline usage function paccache: streamline usage function pacdiff: streamline usage function pacdiff: proper option handling pacdiff: streamline option syntax with makepkg paclist: streamline usage function paclog-pkglist: streamline usage function pacscripts: streamline usage function updpkgsums: streamline usage function rankmirrors: streamline usage function rankmirrors: proper option handling
contrib/checkupdates.sh.in | 9 +-- contrib/paccache.sh.in | 61 ++++++++++---------- contrib/pacdiff.sh.in | 76 +++++++++++++++---------- contrib/paclist.sh.in | 10 ++-- contrib/paclog-pkglist.sh.in | 12 ++-- contrib/pacscripts.sh.in | 18 +++--- contrib/rankmirrors.sh.in | 132 +++++++++++++++++++++---------------------- contrib/updpkgsums.sh.in | 21 ++++--- 8 files changed, 179 insertions(+), 160 deletions(-)
-- 2.10.0
On Thu, 2016-09-29 at 09:04 -0400, Dave Reisner wrote:
On Thu, Sep 29, 2016 at 12:23:00PM +0200, Gordian Edenhofer wrote:
Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
Again, you're still putting flag names in the translatable strings. This will only ever end badly.
It has worked great for makepkg, see the git repo for dozens of examples [1]. [1] https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n11 66
On Thu, Sep 29, 2016 at 03:30:30PM +0200, Gordian Edenhofer wrote:
On Thu, 2016-09-29 at 09:04 -0400, Dave Reisner wrote:
On Thu, Sep 29, 2016 at 12:23:00PM +0200, Gordian Edenhofer wrote:
Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
Again, you're still putting flag names in the translatable strings. This will only ever end badly.
It has worked great for makepkg, see the git repo for dozens of examples [1].
[1] https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n11 66
Has it worked great? - id.po contains --noprapare instead of --noprepare - da.po contains --finer instead of --finger - sv.po contains --inout instead of --input Repeating this mistake of allowing flags to be translated is purely cargo-cult nonsense. Please don't do it.
On Thu, 2016-09-29 at 09:56 -0400, Dave Reisner wrote:
On Thu, Sep 29, 2016 at 03:30:30PM +0200, Gordian Edenhofer wrote:
On Thu, 2016-09-29 at 09:04 -0400, Dave Reisner wrote:
On Thu, Sep 29, 2016 at 12:23:00PM +0200, Gordian Edenhofer wrote:
Reorganize scripts in contrib to fit the syntax and style of makepkg. Unify multiple different approaches to e.g. write a usage function, handle options and differences in naming schemas for options.
Again, you're still putting flag names in the translatable strings. This will only ever end badly.
It has worked great for makepkg, see the git repo for dozens of examples [1].
[1] https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in #n11 66
Has it worked great?
- id.po contains --noprapare instead of --noprepare - da.po contains --finer instead of --finger - sv.po contains --inout instead of --input
Repeating this mistake of allowing flags to be translated is purely cargo-cult nonsense. Please don't do it.
Ok, I will resubmit a new version with non-translatable flags.
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
Allow for '-m' as abbreviation for '--nocolor'.
Signed-off-by: Gordian Edenhofer
Switch to parseopts.
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
On Fri, Sep 30, 2016 at 01:47:54PM +0200, Gordian Edenhofer wrote:
Signed-off-by: Gordian Edenhofer
--- contrib/paccache.sh.in | 83 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in index 02fae52..78f566f 100644 --- a/contrib/paccache.sh.in +++ b/contrib/paccache.sh.in @@ -30,6 +30,17 @@ declare delim=$'\n' keep=3 movedir= scanarch= QUIET=0 USE_COLOR='y'
+# 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" "$@" + } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh)
@@ -172,36 +183,48 @@ summarize() { }
usage() { - cat <
I'm going to need convincing that this fits the definition of "streamlined" compared to the current implementation. stream·line /ˈstrēmˌlīn/ 1. design or provide with a form that presents very little resistance to a flow of air or water, increasing speed and ease of movement. 2. make (an organization or system) more efficient and effective by employing faster or simpler working methods. This is neither faster, nor simpler, nor more efficient or effective. It certainly doesn't have lower resistance.
}
version() { -- 2.10.0
On Fri, 2016-09-30 at 08:14 -0400, Dave Reisner wrote:
On Fri, Sep 30, 2016 at 01:47:54PM +0200, Gordian Edenhofer wrote:
Signed-off-by: Gordian Edenhofer
--- contrib/paccache.sh.in | 83 ++++++++++++++++++++++++++++++++---- -------------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in index 02fae52..78f566f 100644 --- a/contrib/paccache.sh.in +++ b/contrib/paccache.sh.in @@ -30,6 +30,17 @@ declare delim=$'\n' keep=3 movedir= scanarch= QUIET=0 USE_COLOR='y' +# 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" "$@" + } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh) @@ -172,36 +183,48 @@ summarize() { } usage() { - cat <
I'm going to need convincing that this fits the definition of "streamlined" compared to the current implementation.
stream·line /ˈstrēmˌlīn/
1. design or provide with a form that presents very little resistance to a flow of air or water, increasing speed and ease of movement. 2. make (an organization or system) more efficient and effective by employing faster or simpler working methods.
This is neither faster, nor simpler, nor more efficient or effective. It certainly doesn't have lower resistance.
Unifying the syntax of the various contrib scripts will make it easier to amend them because you don't have to honor some random style choice from the initial author. I guess most of you are more familiar with how things are done in makepkg than you are with any script in contrib.
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
Signed-off-by: Gordian Edenhofer
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" "$@"
+ }
+fi
+
m4_include(../scripts/library/output_format.sh)
m4_include(../scripts/library/parseopts.sh)
@@ -54,13 +65,18 @@ usage() {
printf -- "$(gettext "Usage: %s [options]
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' "$*"
+ } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh)
@@ -54,13 +65,18 @@ usage() { printf -- "$(gettext "Usage: %s [options]
")\n" "$0" echo printf -- "$(gettext "Options:")\n" - printf -- "$(gettext " -h, --help Show this help message and exit")\n" - printf -- "$(gettext " -q, --quiet Silence most of the status reporting")\n" - printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n" - printf -- "$(gettext " -o, --out <dir> Write output to specified directory (instead of \$PKGDEST)")\n" - printf -- "$(gettext " --pacnew Package .pacnew files")\n" + printf -- " -h, --help " + printf -- "$(gettext "Show this help message and exit")\n"
This splitting/wrapping doesn't really make me think that this is an improvement. Other patches are subjectively worse IMO -- particularly cases where the usage wraps onto multiple lines and you're adding arbitrary amounts of whitespace wrapping. It's hard to get right and I suspect it'll be broken in the future. There's a reason I used a heredoc for paccache's usage function. It's natural, reads easily, and is easy to extend. Still wondering if we actually care about translations for contrib, or if we care about contrib at all.
+ printf -- " -q, --quiet " + printf -- "$(gettext "Silence most of the status reporting")\n" + printf -- " -m, --nocolor " + printf -- "$(gettext "Disable colorized output messages")\n" + printf -- " -o, --out <dir> " + printf -- "$(gettext "Write output to specified directory (instead of %s)")\n" "\$PKGDEST" + printf -- " --pacnew " + printf -- "$(gettext "Package .pacnew files")\n" echo - printf -- "$(gettext "Examples:")" + printf -- "$(gettext "Examples:")" printf -- " %s linux-headers\n" "$myname" printf -- " %s -o ~/packages libarchive\n" "$myname" printf -- " %s --nocolor --pacnew gzip make binutils\n" "$myname" -- 2.10.0
On Fri, 2016-09-30 at 08:14 -0400, 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' "$*"
Yes, this is indeed copy-pasted from makepkg [1] since I though it would be properly scripted there.
+ } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh) @@ -54,13 +65,18 @@ usage() { printf -- "$(gettext "Usage: %s [options]
")\n" "$0" echo printf -- "$(gettext "Options:")\n" - printf -- "$(gettext " -h, --help Show this help message and exit")\n" - printf -- "$(gettext " -q, --quiet Silence most of the status reporting")\n" - printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n" - printf -- "$(gettext " -o, --out <dir> Write output to specified directory (instead of \$PKGDEST)")\n" - printf -- "$(gettext " --pacnew Package .pacnew files")\n" + printf -- " -h, --help " + printf -- "$(gettext "Show this help message and exit")\n" This splitting/wrapping doesn't really make me think that this is an improvement. Other patches are subjectively worse IMO -- particularly cases where the usage wraps onto multiple lines and you're adding arbitrary amounts of whitespace wrapping. It's hard to get right and I suspect it'll be broken in the future. There's a reason I used a heredoc for paccache's usage function. It's natural, reads easily, and is easy to extend.
Still wondering if we actually care about translations for contrib, or if we care about contrib at all.
I really like heredocs and initially submitted my bacman patch using them for the very same reasons you mentioned. However I was advised to follow the style from scripts like makepkg, repo-add etc. [1] https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n12 26
Had to try this myself because I don't trust you on this for whatever reason: $ set -- -a '1 2 3' -b; printf '<%s>\n' "$@" <-a> <1 2 3> <-b> $ set -- -a '1 2 3' -b; printf '<%s>\n' "$*" <-a 1 2 3 -b> Wow uh. So. My own expectation was that "1 2 3" would be split up too instead. I'm not decided on which of these makepkg should do. I can submit the implied makepkg patch and scan the project tree for other instances of this. cheers! mar77i
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
On Sat, 1 Oct 2016 17:41:51 +1000
Allan McRae
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.
Cause you never tested w/out quotes (multiple args): # foo1 test string test string # foo2 test string test string
Allan
On 01/10/16 19:16, Olivier Brunel wrote:
On Sat, 1 Oct 2016 17:41:51 +1000 Allan McRae
wrote: 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.
Cause you never tested w/out quotes (multiple args):
# foo1 test string test string
# foo2 test string test string
Good thing all gettext calls require quotes then. A
participants (5)
-
Allan McRae
-
Dave Reisner
-
Gordian Edenhofer
-
Martin Kühne
-
Olivier Brunel