PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/gettext-real.sh

http://github.com/sukria/Backup-Manager
Shell | 41 lines | 17 code | 3 blank | 21 comment | 1 complexity | 9640d2ebb4ba39be8e89f13ccc8adf87 MD5 | raw file
 1# Copyright © 2005-2016 The Backup Manager Authors
 2#
 3# See the AUTHORS file for details.
 4#
 5# This program is free software; you can redistribute it and/or
 6# modify it under the terms of the GNU General Public License
 7# as published by the Free Software Foundation; either version 2
 8# of the License, or (at your option) any later version.
 9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# Real gettext library.
16
17# Initialize the gettext stuff
18. /usr/bin/gettext.sh
19TEXTDOMAIN=backup-manager
20export TEXTDOMAIN
21
22# This is the wrapper to the gettext function
23# We use eval_gettext in order to substitue every
24# variable prensent in the string.
25function translate()
26{
27    eval_gettext "$1"; echo
28}
29
30# This can do an echo with -n or not, and after 
31# having gettextized the string.
32function echo_translated()
33{
34    if [[ "$1" = "-n" ]]; then
35        message=$(translate "$2")
36        echo -n "$message"
37    else
38        message=$(translate "$1")
39        echo "$message"
40    fi
41}