From f106ad1a8efc3e39c1e818873e53c53aac963faa Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 2 Feb 2015 11:53:03 +0100 Subject: first i18n (WIP) --- jasper.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'jasper.py') diff --git a/jasper.py b/jasper.py index 908523a..02db89e 100755 --- a/jasper.py +++ b/jasper.py @@ -9,6 +9,12 @@ import logging import yaml import argparse +import locale +import gettext +locale.setlocale(locale.LC_ALL, '') +langs = gettext.translation('messages', localedir='./languages', languages=[]) +langs.install() + from client import tts, stt, jasperpath, diagnose # Add jasperpath.LIB_PATH to sys.path @@ -103,10 +109,10 @@ class Jasper(object): def run(self): if 'first_name' in self.config: - salutation = ("How can I be of service, %s?" + salutation = (_("How can I be of service, %s?") % self.config["first_name"]) else: - salutation = "How can I be of service?" + salutation = _("How can I be of service?") self.mic.say(salutation) conversation = Conversation("JASPER", self.mic, self.config) -- cgit v1.3.1