diff options
author | jmpc <jumapico@gmail.com> | 2010-04-02 13:48:56 (GMT) |
---|---|---|
committer | jmpc <jumapico@gmail.com> | 2010-04-02 13:48:56 (GMT) |
commit | 81f2522c98458147802ae2a1ec3b929c497ff152 (patch) | |
tree | 00b88d9fa40efefbabd6b00a1c6311e8c67b65d3 | |
parent | 04898133f5a7d19895576a0df5ead74ac09b07f6 (diff) |
Added internationalization.
-rw-r--r-- | fracciones.activity/fractionpresentation.py | 30 | ||||
-rw-r--r-- | fracciones.activity/locale/es/LC_MESSAGES/fracciones.po | 56 | ||||
-rw-r--r-- | fracciones.activity/locale/fracciones.pot | 55 |
3 files changed, 129 insertions, 12 deletions
diff --git a/fracciones.activity/fractionpresentation.py b/fracciones.activity/fractionpresentation.py index ea618f1..2bdd42e 100644 --- a/fracciones.activity/fractionpresentation.py +++ b/fracciones.activity/fractionpresentation.py @@ -6,6 +6,8 @@ Contain the presentation of the game, a widget descendant from container. import logging import gtk import pango +import gettext +from gettext import gettext as _ import gtkcake from fractionlogic import FractionLogic @@ -18,6 +20,10 @@ log = logging.getLogger() class FractionPresentation(gtk.VBox): def __init__(self): super(FractionPresentation, self).__init__() + + gettext.bindtextdomain("fracciones", "./locale") + gettext.textdomain("fracciones") + # Change font size #settings = gtk.settings_get_default() #settings.set_string_property("gtk-font-name", "Sans 40", "FractionPresentation") @@ -30,33 +36,33 @@ class FractionPresentation(gtk.VBox): # 1. Add the menu bar mb = gtk.MenuBar() self.pack_start(mb, False, False, 0) - + # game menu gamemenu = gtk.Menu() - gamem = gtk.MenuItem("Game") + gamem = gtk.MenuItem(_("Game")) gamem.set_submenu(gamemenu) - new = gtk.MenuItem("New") + new = gtk.MenuItem(_("New")) new.connect("activate", self.menu_game_new) gamemenu.append(new) - exit = gtk.MenuItem("Exit") + exit = gtk.MenuItem(_("Exit")) exit.connect("activate", self.menu_game_exit) gamemenu.append(exit) mb.append(gamem) # help menu helpmenu = gtk.Menu() - helpm = gtk.MenuItem("Help") + helpm = gtk.MenuItem(_("Help")) helpm.set_submenu(helpmenu) - about = gtk.MenuItem("About") + about = gtk.MenuItem(_("About")) about.connect("activate", self.menu_help_about) helpmenu.append(about) mb.append(helpm) # 2. label - label = gtk.Label("""Eat %i/%i"""%self.logic.get_current()) + label = gtk.Label(_("""Eat %i/%i""") % self.logic.get_current()) self.pack_start(label, False, True) self.label = label # 3. cake @@ -66,7 +72,7 @@ class FractionPresentation(gtk.VBox): self.pack_start(aspect) self.cake = cake # 4. button - button = gtk.Button("Check") + button = gtk.Button(_("Check")) button.connect("clicked", self.check_cake) self.pack_start(button, False, True) @@ -83,7 +89,7 @@ class FractionPresentation(gtk.VBox): log.debug("menu_game_exit") gtk.main_quit() - + def menu_help_about(self, menuitem): print menuitem log.debug("menu_help_about") @@ -97,17 +103,17 @@ class FractionPresentation(gtk.VBox): """Clicked button check""" log.debug("on_clicked_check") if self.logic.is_equal(self.cake.current_fraction): - md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, "GOOD!") + md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, _("GOOD!")) md.run() md.destroy() self.new_game() else: - md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, "BAD!") + md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, _("BAD!")) md.run() md.destroy() def new_game(self): self.logic.generate() - self.label.set_text("""Eat %i/%i"""%self.logic.get_current()) + self.label.set_text(_("""Eat %i/%i""") % self.logic.get_current()) self.cake.reset(self.logic.get_current()[1]) diff --git a/fracciones.activity/locale/es/LC_MESSAGES/fracciones.po b/fracciones.activity/locale/es/LC_MESSAGES/fracciones.po new file mode 100644 index 0000000..7d75c84 --- /dev/null +++ b/fracciones.activity/locale/es/LC_MESSAGES/fracciones.po @@ -0,0 +1,56 @@ +# Spanish translations for PROJECT. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-02 08:55+0300\n" +"PO-Revision-Date: 2010-04-02 10:43-0300\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: es <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.4\n" + +#: fractionpresentation.py:42 +msgid "Game" +msgstr "Juego" + +#: fractionpresentation.py:45 +msgid "New" +msgstr "Nuevo" + +#: fractionpresentation.py:49 +msgid "Exit" +msgstr "Salir" + +#: fractionpresentation.py:56 +msgid "Help" +msgstr "Ayuda" + +#: fractionpresentation.py:59 +msgid "About" +msgstr "Sobre" + +#: fractionpresentation.py:65 fractionpresentation.py:118 +#, python-format +msgid "Eat %i/%i" +msgstr "Comer %i/%i" + +#: fractionpresentation.py:75 +msgid "Check" +msgstr "Verificar" + +#: fractionpresentation.py:106 +msgid "GOOD!" +msgstr "BIEN!" + +#: fractionpresentation.py:111 +msgid "BAD!" +msgstr "MAL!" + diff --git a/fracciones.activity/locale/fracciones.pot b/fracciones.activity/locale/fracciones.pot new file mode 100644 index 0000000..165abb3 --- /dev/null +++ b/fracciones.activity/locale/fracciones.pot @@ -0,0 +1,55 @@ +# Translations template for PROJECT. +# Copyright (C) 2010 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2010-04-02 10:43-0300\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" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.4\n" + +#: fractionpresentation.py:42 +msgid "Game" +msgstr "" + +#: fractionpresentation.py:45 +msgid "New" +msgstr "" + +#: fractionpresentation.py:49 +msgid "Exit" +msgstr "" + +#: fractionpresentation.py:56 +msgid "Help" +msgstr "" + +#: fractionpresentation.py:59 +msgid "About" +msgstr "" + +#: fractionpresentation.py:65 fractionpresentation.py:118 +#, python-format +msgid "Eat %i/%i" +msgstr "" + +#: fractionpresentation.py:75 +msgid "Check" +msgstr "" + +#: fractionpresentation.py:106 +msgid "GOOD!" +msgstr "" + +#: fractionpresentation.py:111 +msgid "BAD!" +msgstr "" + |