Use "echo" in case if gettext does not exist

Bug #1819539 reported by Vadim Kochan on 2019-03-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eCryptfs
Undecided
Unassigned

Bug Description

Ecryptfs-utils scripts uses gettext to show translated info/error messages, but
this might be overhead for some small simple systems where gettext
is not needed, so it would be great if the ecryptfs-utils might support the case
w/o using gettext tool, but use instead simple "echo" wrapper when gettext support
is not needed. The solution might be simple - have some common ecryptfs-functions
script which is included by other and checks at runtime if gettext exists (by
which command) - if does not, then use some simple "echo" wrapper for example:

----------->8------------------
#! /bin/sh

GETTEXT_PROG=""
gettext() {
    if [ -z "${GETTEXT_PROG}" ]; then
        GETTEXT_PROG=$(which gettext)
        if [ $? != 0 ]; then
            GETTEXT_PROG=echo
        fi
    fi
    ${GETTEXT_PROG} "$@"
}
------------8<------------------

Vadim Kochan (vkochan) on 2019-03-11
tags: added: feature
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers