]> git.phdru.name Git - m_librarian.git/blob - m_librarian/translations.py
e2234b948de750d12915633345b89b095a014ddb
[m_librarian.git] / m_librarian / translations.py
1
2 import gettext
3 import locale
4 import os
5
6 language = locale.getdefaultlocale()[0]
7 mo_filename = os.path.join(
8     os.path.dirname(__file__), 'translations', language + '.mo')
9 if os.path.exists(mo_filename):
10     mo_file = open(mo_filename, 'rb')
11     translation = gettext.GNUTranslations(mo_file)
12     mo_file.close()
13 else:
14     translation = gettext.NullTranslations()
15 translation.install(unicode=True)