Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/PascalTriangle.activity/pascaltriangle.py
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2013-08-19 02:07:31 (GMT)
committer Philip Withnall <philip@tecnocode.co.uk>2013-08-19 02:07:31 (GMT)
commit6cddc6b24be7a7c3d423002641c277d9ea36fd4f (patch)
tree39348cc9b6763edb077116c5f97bb14afe2b72d1 /PascalTriangle.activity/pascaltriangle.py
parentad55cecbd7ccf4119324527e2c7516bd1b03c7ec (diff)
Add i18n support
Diffstat (limited to 'PascalTriangle.activity/pascaltriangle.py')
-rwxr-xr-xPascalTriangle.activity/pascaltriangle.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/PascalTriangle.activity/pascaltriangle.py b/PascalTriangle.activity/pascaltriangle.py
index 2463cf0..b84d0a9 100755
--- a/PascalTriangle.activity/pascaltriangle.py
+++ b/PascalTriangle.activity/pascaltriangle.py
@@ -25,6 +25,7 @@ from sugar3.graphics.toggletoolbutton import ToggleToolButton
import math, random
from gi.repository import Gtk, Gdk
import cairo
+from gettext import gettext as _
class PascalTriangleActivity(activity.Activity):
def __init__(self, handle):
@@ -337,7 +338,9 @@ class PascalTriangleActivity(activity.Activity):
column_index))
ctx.set_source_rgb(0.0, 0.0, 0.0) # black
elif (row_index, column_index) != self._current_cell:
- cell_text = '?'
+ # Translators: This is the text shown in cells which haven't yet
+ # been filled in by the user.
+ cell_text = _('?')
ctx.set_source_rgb(0.4, 0.4, 0.4) # grey
else:
cell_text = self._current_cell_text
@@ -370,15 +373,15 @@ class PascalTriangleActivity(activity.Activity):
# Check whether all blank cells have been filled.
if len(self._blank_cells) == 0:
alert = Alert()
- alert.props.title = 'You’ve won!'
- alert.props.msg = 'Well done! You’ve completed the Pascal ' + \
- 'Triangle. Do you want to play again?'
+ alert.props.title = _('You’ve won!')
+ alert.props.msg = _('Well done! You’ve completed the Pascal ' + \
+ 'Triangle. Do you want to play again?')
icon = Icon(icon_name = 'emblem-favorite')
alert.props.icon = icon
icon.show()
icon = Icon(icon_name = 'add')
- alert.add_button(Gtk.ResponseType.ACCEPT, 'New Game', icon)
+ alert.add_button(Gtk.ResponseType.ACCEPT, _('New Game'), icon)
icon.show()
alert.connect('response', self._alert_response_cb)
@@ -423,7 +426,7 @@ class PascalTriangleActivity(activity.Activity):
class NewGameButton(ToolButton):
def __init__(self, activity, **kwargs):
ToolButton.__init__(self, 'add', **kwargs)
- self.props.tooltip = 'New Game'
+ self.props.tooltip = _('New Game')
self.props.accelerator = '<Ctrl>N'
self.connect('clicked', self.__new_game_button_clicked_cb, activity)
@@ -435,7 +438,7 @@ class HintButton(ToggleToolButton):
def __init__(self, activity, **kwargs):
ToggleToolButton.__init__(self, 'toolbar-help', **kwargs)
#self.props.tooltip = 'Show Hints'
- self.set_tooltip('Show Hints')
+ self.set_tooltip(_('Show Hints'))
self.props.accelerator = '<Ctrl>H'
self.connect('clicked', self.__hint_button_clicked_cb, activity)