Skip to content Skip to sidebar Skip to footer

Python : No Translation File Found For Domain Using Custom Locale Folder

I have the following structure : / |- main.py |- brainz | |- __init__.py | |- Brainz.py |- datas |- locale |- en_US |- LC_MESSAGES

Solution 1:

I think your __init__.py should be something like:

import locale
import gettext
import os

current_locale, encoding = locale.getdefaultlocale()

locale_path = 'datas/locale/'
language = gettext.translation ('brainz', locale_path, [current_locale] )
language.install()

Post a Comment for "Python : No Translation File Found For Domain Using Custom Locale Folder"