summaryrefslogtreecommitdiff
path: root/client/modules
diff options
context:
space:
mode:
Diffstat (limited to 'client/modules')
-rw-r--r--client/modules/Joke.py6
-rw-r--r--client/modules/Time.py9
-rw-r--r--client/modules/Unclear.py6
3 files changed, 9 insertions, 12 deletions
diff --git a/client/modules/Joke.py b/client/modules/Joke.py
index a260e5a..72a7b8b 100644
--- a/client/modules/Joke.py
+++ b/client/modules/Joke.py
@@ -3,7 +3,7 @@ import random
import re
from client import jasperpath
-WORDS = ["JOKE", "KNOCK KNOCK"]
+WORDS = [_("JOKE"), _("KNOCK KNOCK")]
def getRandomJoke(filename=jasperpath.data('text', 'JOKES.txt')):
@@ -43,7 +43,7 @@ def handle(text, mic, profile):
"""
joke = getRandomJoke()
- mic.say("Knock knock")
+ mic.say(_("Knock knock"))
def firstLine(text):
mic.say(joke[0])
@@ -63,4 +63,4 @@ def isValid(text):
Arguments:
text -- user-input, typically transcribed speech
"""
- return bool(re.search(r'\bjoke\b', text, re.IGNORECASE))
+ return bool(re.search(r"\b" + _("joke") + r"\b", text, re.IGNORECASE))
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))
diff --git a/client/modules/Unclear.py b/client/modules/Unclear.py
index 071eea3..5701c52 100644
--- a/client/modules/Unclear.py
+++ b/client/modules/Unclear.py
@@ -18,9 +18,9 @@ def handle(text, mic, profile):
number)
"""
- messages = ["I'm sorry, could you repeat that?",
- "My apologies, could you try saying that again?",
- "Say that again?", "I beg your pardon?"]
+ messages = [_("I'm sorry, could you repeat that?"),
+ _("My apologies, could you try saying that again?"),
+ _("Say that again?"), _("I beg your pardon?")]
message = random.choice(messages)