Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
6de8107e
Commit
6de8107e
authored
Apr 03, 2024
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-sh-functions: enable gettext translation
parent
7bfd8de9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
27 deletions
+45
-27
epm-sh-functions
bin/epm-sh-functions
+45
-27
No files found.
bin/epm-sh-functions
View file @
6de8107e
...
...
@@ -93,7 +93,7 @@ restore_color()
echover
()
{
[
-z
"
$verbose
"
]
&&
return
echo
"
$*
"
>
&2
echo
g
"
$*
"
>
&2
}
# echo string without EOL
...
...
@@ -323,19 +323,27 @@ sudoepm()
sudorun
$CMDSHELL
$bashopt
$PROGDIR
/
$PROGNAME
--inscript
"
$@
"
}
echog
()
{
if
[
"
$1
"
=
"-n"
]
;
then
shift
eval_gettext
"
$*
"
else
eval_gettext
"
$*
"
;
echo
fi
}
# Print error message and stop the program
fatal
()
{
local
PROMOMESSAGE
=
"
$EPMPROMOMESSAGE
"
[
-n
"
$PROMOMESSAGE
"
]
||
PROMOMESSAGE
=
" (you can discuss the epm
$EPMVERSION
problem in Telegram: https://t.me/useepm)"
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
set_color
$RED
>
&2
echo
-n
"ERROR: "
>
&2
restore_color
>
&2
echo
"
$*
$PROMOMESSAGE
"
>
&2
# else
# echog "Error in $0: $@" >&2
fi
set_color
$RED
>
&2
echog
-n
"ERROR: "
>
&2
restore_color
>
&2
echog
"
$*
$PROMOMESSAGE
"
>
&2
# [ "$TERM" = "screen" ] && echo "(screen detected: waiting ten seconds to exit ...)" >&2 && sleep 10
exit
1
}
...
...
@@ -344,28 +352,21 @@ fatal()
debug
()
{
[
-n
"
$debug
"
]
||
return
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
set_color
$YELLOW
>
&2
echo
-n
"WARNING: "
>
&2
restore_color
>
&2
echo
"
$*
"
>
&2
# else
# echog "Error in $0: $@" >&2
fi
set_color
$YELLOW
>
&2
echog
-n
"WARNING: "
>
&2
restore_color
>
&2
echog
"
$*
"
>
&2
}
# Print warning message
warning
()
{
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
set_color
$YELLOW
>
&2
echo
-n
"WARNING: "
>
&2
restore_color
>
&2
echo
"
$*
"
>
&2
# else
# echog "Error in $0: $@" >&2
fi
set_color
$YELLOW
>
&2
echog
-n
"WARNING: "
>
&2
restore_color
>
&2
echog
"
$*
"
>
&2
}
info
()
...
...
@@ -375,9 +376,9 @@ info()
# print message to stderr if stderr forwarded to (a file)
if
isatty2
;
then
isatty
||
return
0
echo
"
$*
"
echo
g
"
$*
"
else
echo
"
$*
"
>
&2
echo
g
"
$*
"
>
&2
fi
}
...
...
@@ -1058,3 +1059,20 @@ check_core_commands()
is_command
sed
||
fatal
"Can't find sed command (sed package is missed?)"
}
export
TEXTDOMAIN
=
eepm
if
[
"
$EPMMODE
"
=
"git"
]
;
then
TEXTDOMAINDIR
=
$PROGDIR
/../po
else
TEXTDOMAINDIR
=
'/usr/share/locale'
fi
export
TEXTDOMAINDIR
if
[
-d
"
$TEXTDOMAINDIR
"
]
&&
is_command gettext.sh
;
then
.
gettext.sh
else
eval_gettext
()
{
echo
-n
$@
}
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment