Skip to content

Commit

Permalink
Internationalize questions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Oct 20, 2010
1 parent 6b26861 commit da9a1bf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
22 changes: 21 additions & 1 deletion locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2010-10-20 18:27+CEST\n"
"POT-Creation-Date: 2010-10-20 18:33+CEST\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -1009,3 +1009,23 @@ msgid ""
" what's breaking or when, but think that it might be logged."
msgstr ""

#: src/questions.py:60
msgid "Sorry, that response was not an option."
msgstr ""

#: src/questions.py:106
msgid "Sorry, you must enter a value."
msgstr ""

#: src/questions.py:126
msgid "Enter password: "
msgstr ""

#: src/questions.py:128
msgid "Re-enter password: "
msgstr ""

#: src/questions.py:141
msgid "Passwords don't match."
msgstr ""

14 changes: 10 additions & 4 deletions src/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

import supybot.ansi as ansi
import supybot.utils as utils
from supybot.i18n import PluginInternationalization, internationalizeDocstring
_ = PluginInternationalization()

useBold = False

Expand All @@ -55,7 +57,7 @@ def expect(prompt, possibilities, recursed=False, default=None,
prompt = utils.str.normalizeWhitespace(prompt)
originalPrompt = prompt
if recursed:
output('Sorry, that response was not an option.')
output(_('Sorry, that response was not an option.'))
if useBold:
choices = '[%s%%s%s]' % (ansi.RESET, ansi.BOLD)
else:
Expand Down Expand Up @@ -101,7 +103,7 @@ def something(prompt, default=None):
"""Allow anything *except* nothing from the user."""
s = expect(prompt, [], default=default)
while not s:
output('Sorry, you must enter a value.')
output(_('Sorry, you must enter a value.'))
s = expect(prompt, [], default=default)
return s

Expand All @@ -118,8 +120,12 @@ def yn(prompt, default=None):
else:
return False

def getpass(prompt='Enter password: ', secondPrompt='Re-enter password: '):
def getpass(prompt=None, secondPrompt=None):
"""Prompt the user for a password."""
if prompt is None:
prompt = _('Enter password: ')
if secondPrompt is None:
secondPrompt = _('Re-enter password: ')
password = ''
secondPassword = ' ' # Note that this should be different than password.
assert prompt
Expand All @@ -132,7 +138,7 @@ def getpass(prompt='Enter password: ', secondPrompt='Re-enter password: '):
password = getPass(prompt)
secondPassword = getPass(secondPrompt)
if password != secondPassword:
output('Passwords don\'t match.')
output(_('Passwords don\'t match.'))
else:
break
return password
Expand Down

0 comments on commit da9a1bf

Please sign in to comment.