From fe02dbcfb22bef26c0490d826ed29b49551a3cdf Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 2 Feb 2015 12:06:34 +0100 Subject: add language config option --- jasper.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'jasper.py') diff --git a/jasper.py b/jasper.py index 41797d4..89fbbd9 100755 --- a/jasper.py +++ b/jasper.py @@ -1,6 +1,9 @@ #!/usr/bin/env python2 # -*- coding: utf-8-*- +# add additional translations here +LANGUAGES = ['de_DE'] + import os import sys import shutil @@ -11,9 +14,6 @@ import argparse import locale import gettext -locale.setlocale(locale.LC_ALL, '') -langs = gettext.translation('messages', localedir='./languages', languages=['de_DE']) -langs.install() from client import tts, stt, jasperpath, diagnose @@ -86,6 +86,13 @@ class Jasper(object): self._logger.error("Can't open config file: '%s'", new_configfile) raise + if 'lang' in self.config: + locale.setlocale(locale.LC_ALL, self.config['lang']) + else: + locale.setlocale(locale.LC_ALL, '') + _langs = gettext.translation('messages', localedir='./languages', languages=LANGUAGES) + _langs.install() + try: stt_engine_slug = self.config['stt_engine'] except KeyError: -- cgit v1.3.1