Skip to content

Commit

Permalink
Replace pgettext with gettext to work around broken genpot string gen…
Browse files Browse the repository at this point in the history
…eration SL#3668
  • Loading branch information
garycmartin committed Jun 12, 2012
1 parent 33f96cc commit 8b9af01
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
49 changes: 24 additions & 25 deletions clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
import gc
import re

from pgettext import pgettext as _
from gettext import gettext as _

from sugar.activity import activity
from sugar.graphics.toggletoolbutton import ToggleToolButton
Expand Down Expand Up @@ -117,28 +117,28 @@ def __init__(self, handle):
super(ClockActivity, self).__init__(handle)

# TRANS: Title of the activity
self.set_title(_("Activity", "What Time Is It?"))
self.set_title(_('What Time Is It?'))

# TRANS: The format used when writing the time in full
# letters. You must take care to use a font size large enough
# so that kids can read it easily, but also small enough so
# that all times combination fit on the screen, even when the
# screen is rotated. Pango markup:
# http://www.pygtk.org/docs/pygtk/pango-markup-language.html
self._TIME_LETTERS_FORMAT = _("Write Time",
'<markup><span lang="en" font_desc="Sans 20">%s</span></markup>')
self._TIME_LETTERS_FORMAT = _('<markup>\
<span lang="en" font_desc="Sans 20">%s</span></markup>')

# TRANS: The format used to display the weekday and date
# (example: Tuesday 10/21/2008) We recommend to use the same
# font size as for the time display. See
# http://docs.python.org/lib/module-time.html for available
# strftime formats. xgettext:no-python-format
self._DATE_SHORT_FORMAT = _("Write Date",
'<markup><span lang="en" font_desc="Sans 20">' +
'<span foreground="#B20008">%A</span>, ' +
'<span foreground="#5E008C">%m</span>/' +
'<span foreground="#B20008">%d</span>/' +
'<span foreground="#9A5200">%Y</span></span></markup>')
self._DATE_SHORT_FORMAT = _('<markup>\
<span lang="en" font_desc="Sans 20">\
<span foreground="#B20008">%A</span>, \
<span foreground="#5E008C">%m</span>/\
<span foreground="#B20008">%d</span>/\
<span foreground="#9A5200">%Y</span></span></markup>')

# Should we write the time in full letters?
self._write_time = False
Expand Down Expand Up @@ -229,7 +229,7 @@ def _make_toolbars(self):

# Add the toolbar to the activity menu
self._add_clock_controls(display_toolbar)
toolbox.add_toolbar(_("Toolbar", "Clock"), display_toolbar)
toolbox.add_toolbar(_('Clock'), display_toolbar)
toolbox.set_current_toolbar(1)

return toolbox
Expand Down Expand Up @@ -260,19 +260,19 @@ def _add_clock_controls(self, display_toolbar):

# First group of radio button to select the type of clock to display
button1 = RadioToolButton(named_icon="simple-clock")
button1.set_tooltip(_("Toolbar", "Simple Clock"))
button1.set_tooltip(_('Simple Clock'))
button1.connect("toggled", self._display_mode_changed_cb,
_MODE_SIMPLE_CLOCK)
display_toolbar.insert(button1, -1)
button2 = RadioToolButton(named_icon="nice-clock",
group=button1)
button2.set_tooltip(_("Toolbar", "Nice Clock"))
button2.set_tooltip(_('Nice Clock'))
button2.connect("toggled", self._display_mode_changed_cb,
_MODE_NICE_CLOCK)
display_toolbar.insert(button2, -1)
button3 = RadioToolButton(named_icon="digital-clock",
group=button1)
button3.set_tooltip(_("Toolbar", "Digital Clock"))
button3.set_tooltip(_('Digital Clock'))
button3.connect("toggled", self._display_mode_changed_cb,
_MODE_DIGITAL_CLOCK)
display_toolbar.insert(button3, -1)
Expand All @@ -286,13 +286,13 @@ def _add_clock_controls(self, display_toolbar):
# of week... A button in the toolbar to write the time in
# full letters
button = ToggleToolButton("write-time")
button.set_tooltip(_("Toolbar", "Display time in full letters"))
button.set_tooltip(_('Display time in full letters'))
button.connect("toggled", self._write_time_clicked_cb)
display_toolbar.insert(button, -1)

# The button to display the weekday and date
button = ToggleToolButton("write-date")
button.set_tooltip(_("Toolbar", "Display weekday and date"))
button.set_tooltip(_('Display weekday and date'))
button.connect("toggled", self._write_date_clicked_cb)
display_toolbar.insert(button, -1)

Expand All @@ -303,7 +303,7 @@ def _add_clock_controls(self, display_toolbar):

# Another button to speak aloud the time
button = ToggleToolButton("speak-time")
button.set_tooltip(_("Toolbar", "Talking clock"))
button.set_tooltip(_('Talking clock'))
button.connect("toggled", self._speak_time_clicked_cb)
display_toolbar.insert(button, -1)

Expand Down Expand Up @@ -660,11 +660,11 @@ def _draw_time(self):
# horizontally, it means that the glyphs of the digits used in
# the font don't have the same width. Try to use a Monospace
# font. xgettext:no-python-format
markup = _("Digital Clock",
'<markup><span lang="en" font_desc="Sans,Monospace Bold 48">' +
'<span foreground="#005FE4">%I</span>:' +
'<span foreground="#00B20D">%M</span>:' +
'<span foreground="#E6000A">%S</span>%p</span></markup>')
markup = _('<markup>\
<span lang="en" font_desc="Sans,Monospace Bold 48">\
<span foreground="#005FE4">%I</span>:\
<span foreground="#00B20D">%M</span>:\
<span foreground="#E6000A">%S</span>%p</span></markup>')
# BUG: The following line kills Python 2.5 but is valid in 2.4
markup_time = self._time.strftime(markup)
#markup_time = time.strftime(markup)
Expand Down Expand Up @@ -783,9 +783,8 @@ def _draw_numbers(self):
for i in xrange(12):
# TRANS: The format of the font used to print hour
# numbers, from 1 to 12.
hour_number = _("Hour Number",
'<markup><span lang="en" ' +
'font_desc="Sans Bold 20">%d</span></markup>') % (i + 1)
hour_number = _('<markup><span lang="en" \
font_desc="Sans Bold 20">%d</span></markup>') % (i + 1)
self._draw_markup(self._center_x + 0.75 * \
self._radius * math.cos((i - 2) * math.pi / 6.0), \
self._center_y + 0.75 * self._radius * \
Expand Down
13 changes: 7 additions & 6 deletions speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
import os

from pgettext import pgettext as _
from gettext import gettext as _


class Speaker:
Expand All @@ -26,29 +26,30 @@ class Speaker:
"""
# TRANS: The language pitch (range [0 - 99], default 50 for English)
# Look at http://espeak.sourceforge.net/commands.html for details
PITCH = _("espeak-pitch", "50")
PITCH = _("50")


"""espeak parameter: diction speed (average words per minute).
"""
# TRANS: The diction speed, in average words per minute (range [80 - 390], default 170 for English).
# TRANS: The diction speed, in average words per minute (range [80 - 390],
# default 170 for English).
# Look at http://espeak.sourceforge.net/commands.html for details
SPEED = _("espeak-speed", "170")
SPEED = _("170")


"""espeak parameter: word gap in units of 10 ms.
"""
# TRANS: The pause duration between words, in units of 10 ms.
# Look at http://espeak.sourceforge.net/commands.html for details
WORD_GAP = _("espeak-wgap", "0")
WORD_GAP = _("0")


"""espeak parameter: the language and voice variant.
"""
# TRANS: The language and voice variant
# Look at http://espeak.sourceforge.net/commands.html for details, and
# http://espeak.sourceforge.net/languages.html to see if your language is supported.
VOICE = _("espeak-voice", "en")
VOICE = _("en")


def speak(self, text):
Expand Down

0 comments on commit 8b9af01

Please sign in to comment.