X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/8550d172b829f29b2fcd4723789fb2a5d9fff6eb..ecc4f5c21f155d689a75cb3f48b154ba37501583:/src/librarian/util.py?ds=sidebyside diff --git a/src/librarian/util.py b/src/librarian/util.py index 5c9fbc2..63e7996 100644 --- a/src/librarian/util.py +++ b/src/librarian/util.py @@ -128,3 +128,14 @@ def roman_to_int(input): def makedirs(path): if not os.path.isdir(path): os.makedirs(path) + + +def get_translation(language): + import gettext + from .functions import lang_code_3to2 + + return gettext.translation( + 'messages', + localedir=os.path.join(os.path.dirname(__file__), 'locale'), + languages=[lang_code_3to2(language), 'pl'], + )