aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-03-25 13:50:10 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-04-07 16:43:36 -0400
commit668b7c851904b0033eefd28d0a54654653ffaef3 (patch)
tree0999eb3126fc3eb008fed875dd2fdf88e3cc43a1
parent89d6182fc9690bae3049fbaf8cf9a1159a66b3e1 (diff)
downloadsos-668b7c851904b0033eefd28d0a54654653ffaef3.tar.gz
[utilities] Move gettext into utilities
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/utilities.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sos/utilities.py b/sos/utilities.py
index 871956c1..851b7715 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -19,6 +19,7 @@ import shlex
import glob
import threading
import time
+import gettext
from contextlib import closing
from collections import deque
@@ -26,6 +27,17 @@ from collections import deque
# PYCOMPAT
import six
+gettext_dir = "/usr/share/locale"
+gettext_app = "sos"
+
+gettext.bindtextdomain(gettext_app, gettext_dir)
+
+
+def _default(msg):
+ return gettext.dgettext(gettext_app, msg)
+
+
+_sos = _default
def tail(filename, number_of_bytes):
"""Returns the last number_of_bytes of filename"""