translater = gettext.translation(domain, localedir, [mylocale.
    GetCanonicalName()], fallback=True)
translater.install(str=True)
msg = _(
    'A message that gettext will translate, probably putting Unicode in here')
Logfile = codecs.open(logfile_name, 'w', encoding='utf-8')
Logfile.write(msg + '\n')
UnicodeEncodeError при записи в файл