Ensure a unicode string is returned

This commit is contained in:
Alexander Grothe 2019-05-16 13:07:40 +02:00
parent c522d19c2b
commit 23e54c67a7

View File

@ -15,14 +15,15 @@ ANSIBLE_METADATA = {
import gettext import gettext
from ansible.errors import AnsibleFilterError from ansible.errors import AnsibleFilterError
from ansible.utils import helpers from ansible.utils import helpers
from ansible.module_utils._text import to_text
def translate_yavdr(text): def translate_yavdr(text):
gettext.textdomain('yavdr') gettext.textdomain('yavdr')
try: try:
return gettext.gettext(text) return to_text(gettext.gettext(text))
except: except:
return text return to_text(text)
# ---- Ansible filters ---- # ---- Ansible filters ----
class FilterModule(object): class FilterModule(object):