From f106ad1a8efc3e39c1e818873e53c53aac963faa Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 2 Feb 2015 11:53:03 +0100 Subject: first i18n (WIP) --- client/modules/Time.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'client/modules/Time.py') diff --git a/client/modules/Time.py b/client/modules/Time.py index 4726839..0d57265 100644 --- a/client/modules/Time.py +++ b/client/modules/Time.py @@ -2,9 +2,8 @@ import datetime import re from client.app_utils import getTimezone -from semantic.dates import DateService -WORDS = ["TIME"] +WORDS = [_("TIME")] def handle(text, mic, profile): @@ -20,9 +19,7 @@ def handle(text, mic, profile): tz = getTimezone(profile) now = datetime.datetime.now(tz=tz) - service = DateService() - response = service.convertTime(now) - mic.say("It is %s right now." % response) + mic.say(_("It is %s right now.") % now.strftime(_("%I %M %p"))) def isValid(text): @@ -32,4 +29,4 @@ def isValid(text): Arguments: text -- user-input, typically transcribed speech """ - return bool(re.search(r'\btime\b', text, re.IGNORECASE)) + return bool(re.search(r"\b" + _("time") + r"\b", text, re.IGNORECASE)) -- cgit v1.3.1