From 23e54c67a7410ce8de6ffb55ab2e7b0a9c8212d8 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Thu, 16 May 2019 13:07:40 +0200 Subject: [PATCH] Ensure a unicode string is returned --- filter_plugins/translate_yavdr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/filter_plugins/translate_yavdr.py b/filter_plugins/translate_yavdr.py index 3eb535a..975e1db 100644 --- a/filter_plugins/translate_yavdr.py +++ b/filter_plugins/translate_yavdr.py @@ -15,14 +15,15 @@ ANSIBLE_METADATA = { import gettext from ansible.errors import AnsibleFilterError from ansible.utils import helpers +from ansible.module_utils._text import to_text def translate_yavdr(text): gettext.textdomain('yavdr') try: - return gettext.gettext(text) + return to_text(gettext.gettext(text)) except: - return text + return to_text(text) # ---- Ansible filters ---- class FilterModule(object):