From a9ddf08e7cf5eb7a5570bd792bad4665367ec4b9 Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Tue, 27 Nov 2012 13:49:15 +0000 Subject: Add i18n strings. --- diff --git a/BiblioJAM/JAMBoardEntryText.py b/BiblioJAM/JAMBoardEntryText.py index e845717..2b3fc86 100644 --- a/BiblioJAM/JAMBoardEntryText.py +++ b/BiblioJAM/JAMBoardEntryText.py @@ -11,6 +11,8 @@ import pygame, gc, sys, tempfile from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG from JAMBoard import JAMBoard from JAMEntryText import JAMEntryText @@ -305,7 +307,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() diff --git a/BiblioJAM/JAMBoardTypes.py b/BiblioJAM/JAMBoardTypes.py index a3ba06e..97427d5 100644 --- a/BiblioJAM/JAMBoardTypes.py +++ b/BiblioJAM/JAMBoardTypes.py @@ -11,6 +11,8 @@ import pygame, gc, sys from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG from JAMLabel import JAMLabel from JAMButton import JAMButton @@ -301,7 +303,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() diff --git a/BiblioJAM/JAMBook.py b/BiblioJAM/JAMBook.py index f01e993..b97cdb7 100644 --- a/BiblioJAM/JAMBook.py +++ b/BiblioJAM/JAMBook.py @@ -12,6 +12,8 @@ from pygame.locals import * gc.enable() +from gettext import gettext as _ + from JAMLabel import JAMLabel from JAMButton import JAMButton @@ -176,7 +178,7 @@ class Ejemplo(object): # Variables obligatorias en tu juego para poder utilizar JAMatrix. self.resolucion = (1200,800) self.ventana = None - self.name= "Ejemplo JAMBook" + self.name= _("Example JAMBook") self.estado = False # Variables del juego @@ -231,7 +233,7 @@ class Ejemplo(object): self.jambook= JAMBook(TEXTO) self.jambook.set_callback_cerrar(self.salir) - pygame.display.set_caption("Ejemplo de JAMBook") + pygame.display.set_caption(_("Example JAMBook")) pygame.event.set_blocked([JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP, JOYBUTTONDOWN, KEYUP, USEREVENT, QUIT, ACTIVEEVENT]) pygame.event.set_allowed([MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN, KEYDOWN, VIDEORESIZE, VIDEOEXPOSE]) diff --git a/BiblioJAM/JAMButton.py b/BiblioJAM/JAMButton.py index b302d51..be55979 100644 --- a/BiblioJAM/JAMButton.py +++ b/BiblioJAM/JAMButton.py @@ -11,6 +11,8 @@ import pygame, gc, sys from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG from JAMLabel import JAMLabel @@ -465,7 +467,7 @@ class Ejemplo(object): color = random.choice(colores) self.widgets.sprites()[0].set_text(tipo=None, tamanio=None, color=color, texto=None) if modificar == "texto": - textos= ["JAMLabel", "Presiona escape cuando quieras salir", "Modificando Texto en JAMLabel", "CeibalJAM 2011"] + textos= ["JAMLabel", _("Press escape to leave anytime"), _("Modifying Text in JAMLabel"), "CeibalJAM 2011"] texto = random.choice(textos) self.widgets.sprites()[0].set_text(tipo=None, tamanio=None, color=None, texto=texto) return 0 @@ -526,12 +528,12 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() self.widgets = pygame.sprite.OrderedUpdates() - self.widgets.add(JAMButton("JAMButton Prueba", None, tipo="elipse")) + self.widgets.add(JAMButton(_("Test JAMButton"), None, tipo="elipse")) self.ventana = pygame.display.get_surface() self.reloj = pygame.time.Clock() diff --git a/BiblioJAM/JAMCalendar.py b/BiblioJAM/JAMCalendar.py index 1fefa1c..8213de8 100644 --- a/BiblioJAM/JAMCalendar.py +++ b/BiblioJAM/JAMCalendar.py @@ -12,6 +12,8 @@ from pygame.locals import * gc.enable() pygame.font.init() +from gettext import gettext as _ + import JAMGlobals as VG from JAMButton import JAMButton from JAMLabel import JAMLabel @@ -748,7 +750,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() self.widgets = JAMCalendar() #self.widgets.set_posicion(punto= (50,50)) diff --git a/BiblioJAM/JAMClock.py b/BiblioJAM/JAMClock.py index 7719586..e58dfd3 100644 --- a/BiblioJAM/JAMClock.py +++ b/BiblioJAM/JAMClock.py @@ -12,6 +12,8 @@ from pygame.locals import * gc.enable() pygame.font.init() +from gettext import gettext as _ + import JAMGlobals as VG from JAMButton import JAMButton @@ -355,7 +357,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() self.widgets = JAMClock() self.widgets.set_posicion(punto= (50,50)) diff --git a/BiblioJAM/JAMComboBox.py b/BiblioJAM/JAMComboBox.py index b0ec196..15fc47e 100644 --- a/BiblioJAM/JAMComboBox.py +++ b/BiblioJAM/JAMComboBox.py @@ -12,6 +12,8 @@ from pygame.locals import * gc.enable() pygame.font.init() +from gettext import gettext as _ + import JAMGlobals as VG from JAMButton import JAMButton @@ -338,9 +340,9 @@ class Ejemplo(object): self.fondo = self.get_Fondo() self.widgets = JAMComboBox() - self.widgets.add_item("Salir", callback= self.salir) - self.widgets.add_item("Prueba de Item 1", callback= None) - self.widgets.add_item("Ultima Prueba de Item", callback= None) + self.widgets.add_item(_("Leave"), callback= self.salir) + self.widgets.add_item(_("Test Item 1"), callback= None) + self.widgets.add_item(_("Last Test Item"), callback= None) self.widgets.set_posicion(punto= (50,50)) self.ventana = pygame.display.get_surface() diff --git a/BiblioJAM/JAMCron.py b/BiblioJAM/JAMCron.py index 594a2e1..04c298e 100644 --- a/BiblioJAM/JAMCron.py +++ b/BiblioJAM/JAMCron.py @@ -11,6 +11,8 @@ import pygame, gc, sys, time, os from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG from JAMButton import JAMButton @@ -168,7 +170,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo de JAMCron") + pygame.display.set_caption(_("Example of JAMCron")) self.fondo = self.get_Fondo() self.widgets = JAMCron() diff --git a/BiblioJAM/JAMDialog.py b/BiblioJAM/JAMDialog.py index c3cec16..0071e72 100644 --- a/BiblioJAM/JAMDialog.py +++ b/BiblioJAM/JAMDialog.py @@ -11,6 +11,8 @@ import pygame, gc, sys from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG from JAMLabel import JAMLabel from JAMButton import JAMButton @@ -239,11 +241,11 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() - self.widgets = JAMDialog(mensaje="Prueba JAMDialog", funcion_ok=None, funcion_cancel=None) + self.widgets = JAMDialog(mensaje=_("Test JAMDialog"), funcion_ok=None, funcion_cancel=None) self.widgets.connect(funcion_ok=self.salir, funcion_cancel=self.salir) self.ventana = pygame.display.get_surface() @@ -305,7 +307,7 @@ class Ejemplo(object): color = random.choice(colores) self.widgets.set_text(tipo=None, tamanio=None, color=color, texto=None) if modificar == "texto": - textos= ["JAMLabel", "Presiona escape cuando quieras salir", "Modificando Texto en JAMLabel", "CeibalJAM 2011"] + textos= ["JAMLabel", _("Press escape to leave anytime"), _("Modifying Text in JAMLabel"), "CeibalJAM 2011"] texto = random.choice(textos) self.widgets.set_text(tipo=None, tamanio=None, color=None, texto=texto) return 0 @@ -371,7 +373,7 @@ class Ejemplo(object): color = random.choice(colores) self.widgets.set_text_buttons(color=color) if modificar == "texto": - textos= ["JAMLabel", "Presiona escape cuando quieras salir", "Modificando Texto en JAMLabel", "CeibalJAM 2011"] + textos= ["JAMLabel", _("Press escape to leave anytime"), _("Modifying Text in JAMLabel"), "CeibalJAM 2011"] texto = random.choice(textos) self.widgets.set_text_buttons(textoaceptar=texto, textocancelar=texto) return 0 diff --git a/BiblioJAM/JAMDragAndDrop.py b/BiblioJAM/JAMDragAndDrop.py index 7134cd1..9956945 100644 --- a/BiblioJAM/JAMDragAndDrop.py +++ b/BiblioJAM/JAMDragAndDrop.py @@ -11,6 +11,8 @@ import pygame, gc, sys from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG class JAMDragAndDrop(): @@ -88,7 +90,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() from JAMCalendar import JAMCalendar diff --git a/BiblioJAM/JAMEntryText.py b/BiblioJAM/JAMEntryText.py index 47dc2da..659154d 100644 --- a/BiblioJAM/JAMEntryText.py +++ b/BiblioJAM/JAMEntryText.py @@ -12,6 +12,8 @@ from pygame.locals import * gc.enable() pygame.font.init() +from gettext import gettext as _ + import JAMGlobals as VG from JAMLabel import JAMLabel @@ -417,7 +419,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo") + pygame.display.set_caption(_("Example")) self.fondo = self.get_Fondo() diff --git a/BiblioJAM/JAMFire.py b/BiblioJAM/JAMFire.py index fc60983..5fdc4c8 100644 --- a/BiblioJAM/JAMFire.py +++ b/BiblioJAM/JAMFire.py @@ -11,6 +11,8 @@ import pygame, gc, sys, os from pygame.locals import * gc.enable() +from gettext import gettext as _ + import JAMGlobals as VG class JAMFire(pygame.sprite.OrderedUpdates): @@ -121,7 +123,7 @@ class Ejemplo(object): def setup(self): pygame.init() pygame.display.set_mode(self.resolucion , 0, 0) - pygame.display.set_caption("Ejemplo de Efecto JAMFire") + pygame.display.set_caption(_("Effect Example JAMFire")) self.fondo = self.get_Fondo() #from JAMDragAndDrop import JAMDragAndDrop diff --git a/BiblioJAM/JAMGlobals.py b/BiblioJAM/JAMGlobals.py index eda39b0..e5a2bf2 100644 --- a/BiblioJAM/JAMGlobals.py +++ b/BiblioJAM/JAMGlobals.py @@ -11,6 +11,8 @@ import pygame, gc, sys, os, platform from pygame.locals import * gc.enable() +from gettext import gettext as _ + ''' if "olpc" in platform.platform(): os.environ['SDL_AUDIODRIVER'] = 'alsa' @@ -276,45 +278,45 @@ def get_calendar(mes, anio): def get_abrevia_mes(numero): ''' Recibe un entero de 1 a 12 y devuelve la abreviación del mes correspondiente.''' numero= int(numero) - if numero== 1: return "ene" - if numero== 2: return "feb" - if numero== 3: return "mar" - if numero== 4: return "abr" - if numero== 5: return "may" - if numero== 6: return "jun" - if numero== 7: return "jul" - if numero== 8: return "ago" - if numero== 9: return "sep" - if numero== 10: return "oct" - if numero== 11: return "nov" - if numero== 12: return "dic" + if numero== 1: return _("jan") + if numero== 2: return _("feb") + if numero== 3: return _("mar") + if numero== 4: return _("apr") + if numero== 5: return _("may") + if numero== 6: return _("jun") + if numero== 7: return _("jul") + if numero== 8: return _("aug") + if numero== 9: return _("sep") + if numero== 10: return _("oct") + if numero== 11: return _("nov") + if numero== 12: return _("dec") def get_mes(numero): ''' Recibe un entero de 1 a 12 y devuelve el nombre del mes correspondiente.''' numero= int(numero) - if numero== 1: return "Enero" - if numero== 2: return "Febrero" - if numero== 3: return "Marzo" - if numero== 4: return "Abril" - if numero== 5: return "Mayo" - if numero== 6: return "Junio" - if numero== 7: return "Julio" - if numero== 8: return "Agosto" - if numero== 9: return "Setiembre" - if numero== 10: return "Octubre" - if numero== 11: return "Noviembre" - if numero== 12: return "Diciembre" + if numero== 1: return _("January") + if numero== 2: return _("February") + if numero== 3: return _("March") + if numero== 4: return _("April") + if numero== 5: return _("May") + if numero== 6: return _("June") + if numero== 7: return _("July") + if numero== 8: return _("August") + if numero== 9: return _("September") + if numero== 10: return _("October") + if numero== 11: return _("November") + if numero== 12: return _("December") def get_dia(numero): ''' Recibe un entero de 1 a 7 y devuelve el nombre del día correspondiente.''' numero= int(numero) - if numero== 1: return "Lunes" - if numero== 2: return "Martes" - if numero== 3: return "Miercoles" - if numero== 4: return "Jueves" - if numero== 5: return "Viernes" - if numero== 6: return "Sabado" - if numero== 7: return "Domingo" + if numero== 1: return _("Moday") + if numero== 2: return _("Tuesday") + if numero== 3: return _("Wednesday") + if numero== 4: return _("Thursday") + if numero== 5: return _("Friday") + if numero== 6: return _("Saturday") + if numero== 7: return _("Sunday") # Efectos def get_fire(): diff --git a/BiblioJAM/JAMLabel.py b/BiblioJAM/JAMLabel.py index 7f5c7ef..f5cd160 100644 --- a/BiblioJAM/JAMLabel.py +++ b/BiblioJAM/JAMLabel.py @@ -13,6 +13,8 @@ gc.enable() pygame.font.init() import JAMGlobals as VG +from gettext import gettext as _ + class JAMLabel(pygame.sprite.Sprite): def __init__(self, texto): pygame.sprite.Sprite.__init__(self) @@ -297,7 +299,7 @@ class Ejemplo(object): color = random.choice(colores) self.widgets.sprites()[0].set_text(tipo=None, tamanio=None, color=color, texto=None) if modificar == "texto": - textos= ["JAMLabel", "Presiona escape cuando quieras salir", "Modificando Texto en JAMLabel", "CeibalJAM 2011"] + textos= ["JAMLabel", _("Press escape to leave anytime"), _("Modifying Text in JAMLabel"), "CeibalJAM 2011"] texto = random.choice(textos) self.widgets.sprites()[0].set_text(tipo=None, tamanio=None, color=None, texto=texto) return 0 @@ -349,7 +351,7 @@ class Ejemplo(object): self.fondo = self.get_Fondo() self.widgets = pygame.sprite.OrderedUpdates() - self.widgets.add(JAMLabel("JAMLabel Prueba")) + self.widgets.add(JAMLabel(_("Test JAMLabel"))) self.ventana = pygame.display.get_surface() self.reloj = pygame.time.Clock() diff --git a/BiblioJAM/JAMatrix.py b/BiblioJAM/JAMatrix.py index 8c0129e..6cc31ab 100644 --- a/BiblioJAM/JAMatrix.py +++ b/BiblioJAM/JAMatrix.py @@ -21,6 +21,8 @@ from JAMCalendar import JAMCalendar import JAMGlobals as VG +from gettext import gettext as _ + class JAMatrix(): ''' Main de JAMatrix. ''' def __init__(self, juego, ventana, resolucion): @@ -159,7 +161,7 @@ class Ejemplo(object): # Variables obligatorias en tu juego para poder utilizar JAMatrix. self.resolucion = (800,600) self.ventana = None - self.name= "Ejemplo JAMatrix" + self.name= _("Example JAMatrix") self.estado = False # Variables del juego @@ -274,7 +276,7 @@ class Ejemplo(object): self.jamclock2.set_posicion(punto= posicion) - pygame.display.set_caption("Ejemplo de Carga de un Juego con JAMatrix") + pygame.display.set_caption(_("Example Loading a game with JAMatrix")) pygame.event.set_blocked([JOYAXISMOTION, JOYBALLMOTION, JOYHATMOTION, JOYBUTTONUP, JOYBUTTONDOWN, KEYUP, USEREVENT, QUIT, ACTIVEEVENT]) pygame.event.set_allowed([MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN, KEYDOWN, VIDEORESIZE, VIDEOEXPOSE]) diff --git a/Cria_Bichos_Main.py b/Cria_Bichos_Main.py index 31db2b6..c26813d 100644 --- a/Cria_Bichos_Main.py +++ b/Cria_Bichos_Main.py @@ -27,6 +27,8 @@ import os import threading import gtk +from gettext import gettext as _ + from pygame.locals import * from math import sin, cos, radians @@ -198,13 +200,13 @@ class Cria_Bichos_Main(): self.event_end_game() # cuando pierde nada más def set_musica(self, button= None): - self.set_mensaje(texto= "Musica Activada.") + self.set_mensaje(texto= _("Music On.")) self.interfaz.boton_musica.set_imagen(origen= self.interfaz.imagenes_audio[0]) pygame.mixer.music.load(VG.MUSICA1) pygame.mixer.music.play(-1, 0.0) def set_pause_musica(self, button= None): - self.set_mensaje(texto="Musica Desactivada.") + self.set_mensaje(texto=_("Music Off.")) self.interfaz.boton_musica.set_imagen(origen= self.interfaz.imagenes_audio[1]) if pygame.mixer.music.get_busy(): pygame.mixer.music.stop() @@ -240,7 +242,7 @@ class Cria_Bichos_Main(): self.puntos += 1 migracion_hembras -= 1 - self.set_mensaje(texto="Algunas Cucarachas han migrado hacia otros habitats.") + self.set_mensaje(texto=_("Some cockroaches have migrated to other habitats.")) def set_mensaje(self, texto=""): self.sonido_bicho.play() @@ -298,7 +300,7 @@ class Cria_Bichos_Main(): if leccion == False: # Cuando es True se está llamando desde el botón para ver la lección self.cadaveres.add(Cadaver(self, posicion=posicion, dias=dias)) - self.set_mensaje(texto="Se han producido muertes en el habitat.") + self.set_mensaje(texto=_("Deaths have occurred in the habitat.")) def event_nacer(self, leccion=False): # nace una cuca @@ -312,7 +314,7 @@ class Cria_Bichos_Main(): if leccion == False: # Cuando es True se está llamando desde el botón para ver la lección self.Bichos.add(Bicho(self)) - self.set_mensaje(texto="Se han producido nacimientos en el habitat.") + self.set_mensaje(texto=_("Births occurred in the habitat.")) def pause_game_lecciones(self): # pausa el juego y reproduce las lecciones @@ -331,7 +333,7 @@ class Cria_Bichos_Main(): def event_muda(self, posicion=(0, 0), tamanio=(63,50)): # dejar exoesqueleto - self.set_mensaje(texto="Algunas Cucarachas han realizado la muda de su exoesqueleto.") + self.set_mensaje(texto=_("Some cockroaches have been shedding their exoskeleton.")) if self.secuencia_muda == 0: self.secuencia_muda = 1 self.sonido_bicho.play() @@ -344,7 +346,7 @@ class Cria_Bichos_Main(): # dejar ooteca if posicion != None: self.ootecas.add(Ooteca(self, posicion=posicion)) - self.set_mensaje(texto="Hay nuevas ootecas en el habitat.") + self.set_mensaje(texto=_("There are new oothecas in habitat.")) if self.reproduccion == 0: # self.reproduccion es para verificar si se ha visto la leccion. @@ -656,19 +658,19 @@ class Cria_Bichos_Main(): self.machos, self.hembras = self.verificar_sexos_en_habitat() total = self.machos + self.hembras ootecas = len(self.ootecas.sprites()) - bichos = "Cucarachas: %s, Machos: %s, Hembras: %s, Ootecas: %s Migración: %s" % (total, self.machos, + bichos = "Cockroaches: %s, Males: %s, Females: %s, Ootecas: %s Migration: %s" % (total, self.machos, self.hembras, ootecas, self.puntos) self.interfaz.set_informacion_de_habitat(bichos) if not self.machos and not ootecas: - self.set_mensaje(texto="No quedan Machos ni ootecas en el habitat, la Reproducción ya no será posible.") + self.set_mensaje(texto=_("Dogs are not the egg cases or habitat, reproduction is no longer possible.")) elif not self.hembras and not ootecas: - self.set_mensaje(texto="No quedan Hembras ni ootecas en el habitat, la Reproducción ya no será posible.") + self.set_mensaje(texto=_("There are no females in the habitat oothecas, reproduction is no longer possible.")) elif not self.machos and not self.hembras and not ootecas: - self.set_mensaje(texto="Todas las Cucarachas han muerto y no hay ootecas en el habitat.") + self.set_mensaje(texto=_("All Cockroaches have died and there oothecas in habitat.")) elif self.machos + self.hembras >= self.maximo_cucas: self.event_plaga() - self.set_mensaje(texto="Hay Demasiadas Cucarachas en el habitat. Algunas migrarán. !!!") + self.set_mensaje(texto=_("Too many cockroaches in the habitat. Some migrated!")) # ************************************* # if self.horas == 24: self.dias += 1 @@ -681,7 +683,7 @@ class Cria_Bichos_Main(): self.dias = 0 if cambios: - tiempo = "Tiempo de Juego = Años: %s Dias: %s Horas: %s" % (self.anios, self.dias, self.horas) + tiempo = _("Playtime = Years: %(Years) Days: %(Days) Hours: %(Hours)" % {'Years':self.anios, 'Days':self.dias, 'Hours':self.horas}) self.interfaz.set_tiempo_de_juego(tiempo) def aumenta_hambre(self): @@ -744,13 +746,13 @@ class Cria_Bichos_Main(): if not self.dialog_cerrar: a,b,c= JAMG.get_estilo_celeste() - self.dialog_cerrar= JAMDialog(mensaje= "¿Deseas Salir del Juego?", + self.dialog_cerrar= JAMDialog(mensaje= _("Do you want to quit the game?"), funcion_ok= self.selecciona_mensaje_guardar, funcion_cancel= self.deselecciona_leccion) self.dialog_cerrar.set_colors_dialog(base= c, bordes= b) self.dialog_cerrar.set_colors_buttons(colorbas= a, colorbor= b, colorcara= c) if not self.dialog_guardar: a,b,c= JAMG.get_estilo_naranja() - self.dialog_guardar= JAMDialog(mensaje= "¿Guardar Antes de Salir?", + self.dialog_guardar= JAMDialog(mensaje= _("Save before exiting?"), funcion_ok= self.guardar_juego, funcion_cancel= self.Borrar_salir) self.dialog_guardar.set_colors_dialog(base= c, bordes= b) self.dialog_guardar.set_colors_buttons(colorbas= a, colorbor= b, colorcara= c) @@ -803,7 +805,7 @@ class Cria_Bichos_Main(): self.alimento.add(self.unidad_alimento) self.puntero.empty() pygame.mouse.set_visible(True) - self.set_mensaje(texto= "Las Cucarachas detectan con sus antenas, el alimento en el habitat.") + self.set_mensaje(texto= _("Cockroaches detect with their antennae, the food in the habitat.")) elif self.agua_select in self.puntero.sprites(): # si tenemos seleccionado el agua, dejar el agua en el escenario if not self.agua.sprites(): @@ -812,7 +814,7 @@ class Cria_Bichos_Main(): self.agua.add(self.unidad_agua) self.puntero.empty() pygame.mouse.set_visible(True) - self.set_mensaje(texto= "Las Cucarachas detectan con sus antenas, el agua en el habitat.") + self.set_mensaje(texto= _("Cockroaches detect with their antennae, water in the habitat.")) elif not self.pan_select in self.puntero.sprites() and not self.agua_select in self.puntero.sprites(): # si no tenemos seleccionado el alimento, vemos si se ha seleccionado alguna cuca @@ -1050,4 +1052,4 @@ class Mensaje(pygame.sprite.OrderedUpdates): self.contador = 0 self.juego.no_mensajes() return - \ No newline at end of file + diff --git a/Ficha_Bicho.py b/Ficha_Bicho.py index de6eb68..d121105 100644 --- a/Ficha_Bicho.py +++ b/Ficha_Bicho.py @@ -26,6 +26,8 @@ from pygame.locals import * gc.enable() +from gettext import gettext as _ + import BiblioJAM from BiblioJAM.JAMLabel import JAMLabel import BiblioJAM.JAMGlobals as JAMG @@ -39,19 +41,19 @@ class Ficha_Bicho(pygame.sprite.OrderedUpdates): self.bicho= None x, y, self.separador= (10, 70, 13) - self.label_tiempo= JAMLabel("Años: 0 Dias: 0 Horas: 0") + self.label_tiempo= JAMLabel(_("Years: 0 Days: 0 Hours: 0")) self.label_tiempo.set_text(tamanio= 30) self.label_tiempo.set_posicion( (x,y) ) self.add(self.label_tiempo) y += self.label_tiempo.get_tamanio()[1] + self.separador - self.label_hambre= JAMLabel("Nivel de Apetito: ") + self.label_hambre= JAMLabel(_("Level of Appetite: ")) self.label_hambre.set_text(tamanio= 25) self.label_hambre.set_posicion( (x,y) ) self.add(self.label_hambre) y += self.label_hambre.get_tamanio()[1] + self.separador - self.label_sed= JAMLabel("Nivel de Sed: ") + self.label_sed= JAMLabel(_("Level Sed: ")) self.label_sed.set_text(tamanio= 25) self.label_sed.set_posicion( (x,y) ) self.add(self.label_sed) @@ -79,16 +81,16 @@ class Ficha_Bicho(pygame.sprite.OrderedUpdates): self.actualizar_datos() def actualizar_datos(self): - edad = "Dias: %s Horas: %s" % (self.bicho.dias, self.bicho.horas) + edad = _("Day: %(Days) Hours: %(Hours)" % {'Days':self.bicho.dias, 'Hours':self.bicho.horas}) if edad != self.label_tiempo.get_text(): self.label_tiempo.set_text(texto= edad) - nutricion = "Nutrición: %s" % (self.bicho.hambre) + nutricion = _("Nutrition: %s" % (self.bicho.hambre)) if nutricion != self.label_hambre.get_text(): self.label_hambre.set_text(texto= nutricion) self.barra_nutricion.set_valor(self.bicho.hambre) - hidratacion = "Hidratación: %s" % (self.bicho.sed) + hidratacion = _("Hydration: %s" % (self.bicho.sed)) if hidratacion != self.label_sed.get_text(): self.label_sed.set_text(texto= hidratacion) self.barra_hidratacion.set_valor(self.bicho.sed) diff --git a/Interfaz.py b/Interfaz.py index 93c145d..8373591 100644 --- a/Interfaz.py +++ b/Interfaz.py @@ -26,6 +26,8 @@ from pygame.locals import * gc.enable() +from gettext import gettext as _ + import BiblioJAM from BiblioJAM.JAMButton import JAMButton from BiblioJAM.JAMLabel import JAMLabel @@ -50,36 +52,36 @@ class Interfaz(pygame.sprite.OrderedUpdates): self.boton_jarra.set_posicion(punto=(x,y)) y += self.boton_jarra.get_tamanio()[1] + separador*2 - self.boton_ciclo= JAMButton("Ciclo Vital", None) + self.boton_ciclo= JAMButton(_("Vital Cycle"), None) self.boton_ciclo.set_text(tamanio= 20) self.boton_ciclo.set_tamanios(tamanio= (ancho_botones, 50)) self.boton_ciclo.set_posicion(punto=(x,y)) y += self.boton_ciclo.get_tamanio()[1] + separador - self.boton_muda= JAMButton("Muda", None) + self.boton_muda= JAMButton(_("Switches"), None) self.boton_muda.set_text(tamanio= 20) self.boton_muda.set_tamanios(tamanio= (ancho_botones, 50)) self.boton_muda.set_posicion(punto=(x,y)) y += self.boton_muda.get_tamanio()[1] + separador - self.boton_reproduccion= JAMButton("Reproducción", None) + self.boton_reproduccion= JAMButton(_("Reproduction"), None) self.boton_reproduccion.set_text(tamanio= 20) self.boton_reproduccion.set_tamanios(tamanio= (ancho_botones, 50)) self.boton_reproduccion.set_posicion(punto=(x,y)) y += self.boton_reproduccion.get_tamanio()[1] + separador - self.boton_muerte= JAMButton("Muerte", None) + self.boton_muerte= JAMButton(_("Death"), None) self.boton_muerte.set_text(tamanio= 20) self.boton_muerte.set_tamanios(tamanio= (ancho_botones, 50)) self.boton_muerte.set_posicion(punto=(x,y)) y += self.boton_reproduccion.get_tamanio()[1] + separador - self.boton_plaga= JAMButton("Plaga", None) + self.boton_plaga= JAMButton(_("Plague"), None) self.boton_plaga.set_text(tamanio= 20) self.boton_plaga.set_tamanios(tamanio= (ancho_botones, 50)) self.boton_plaga.set_posicion(punto=(x,y)) - self.boton_salir= JAMButton("Salir", None) + self.boton_salir= JAMButton(_("Leave"), None) self.boton_salir.set_text(tamanio= 20) self.boton_salir.set_tamanios(tamanio= (ancho_botones, 50)) y = VG.RESOLUCION[1] - separador - self.boton_salir.get_tamanio()[1] @@ -93,7 +95,7 @@ class Interfaz(pygame.sprite.OrderedUpdates): self.boton_musica.set_posicion(punto=(x,y)) self.posicion_boton_audio = (x,y) - self.boton_extras= JAMButton("Lectura", None) + self.boton_extras= JAMButton(_("Reading"), None) self.boton_extras.set_text(tamanio= 20) self.boton_extras.set_tamanios(tamanio= (ancho_botones, 50)) y -= separador + self.boton_extras.get_tamanio()[1] @@ -133,14 +135,14 @@ class Interfaz(pygame.sprite.OrderedUpdates): self.label_agua.set_posicion( (x+w+10, y) ) self.add(self.label_agua) - self.label_tiempo= JAMLabel("Tiempo de Juego = Años: 0 Dias: 0 Horas: 0") + self.label_tiempo= JAMLabel(_("Playtime = Years: 0 Days: 0 Hours: 0")) self.label_tiempo.set_text(tamanio= 25) x, y= self.label_agua.get_posicion() w, h= self.label_agua.get_tamanio() self.label_tiempo.set_posicion( (x+w+10, y) ) self.add(self.label_tiempo) - self.informacion_cucas = "Cucarachas: 0, Machos: 0, Hembras: 0, Ootecas: 0, Migración: 0" + self.informacion_cucas = _("Cockroaches: 0, Males: 0, Females: 0, Ootecas: 0, Migration: 0") self.label_cucas_info= JAMLabel(self.informacion_cucas) self.label_cucas_info.set_text(tamanio= 25) x, y= (10, VG.RESOLUCION[1] - 10 - self.label_cucas_info.get_tamanio()[1]) diff --git a/Main.py b/Main.py index 042d318..ccb0e31 100644 --- a/Main.py +++ b/Main.py @@ -28,6 +28,8 @@ import gtk from pygame.locals import * +from gettext import gettext as _ + gc.enable() import BiblioJAM @@ -329,7 +331,7 @@ class Main(): if not self.dialog_cerrar: a,b,c= JAMG.get_estilo_naranja() - self.dialog_cerrar= JAMDialog(mensaje= "¿Deseas Salir del Juego?", + self.dialog_cerrar= JAMDialog(mensaje= _("Do you want to quit the game?"), funcion_ok= self.salir, funcion_cancel= self.deselecciona_mensaje) self.dialog_cerrar.set_colors_dialog(base= c, bordes= b) self.dialog_cerrar.set_colors_buttons(colorbas= a, colorbor= b, colorcara= c) @@ -354,10 +356,10 @@ class Menu(pygame.sprite.OrderedUpdates): alto = 100 a,b,c= JAMG.get_estilo_celeste() - self.boton_nuevo = JAMButton("Juego Nuevo", None) - self.boton_cargar = JAMButton("Cargar Juego", None) - self.boton_creditos = JAMButton("Creditos", None) - self.boton_salir = JAMButton("Salir", None) + self.boton_nuevo = JAMButton(_("New Game"), None) + self.boton_cargar = JAMButton(_("Load Game"), None) + self.boton_creditos = JAMButton(_("Credits"), None) + self.boton_salir = JAMButton(_("Leave"), None) self.boton_nuevo.set_text(tamanio= 50) self.boton_cargar.set_text(tamanio= 50) @@ -562,12 +564,12 @@ class Item_Juego(): self.etiqueta_juego.set_text(tamanio= 40) self.etiqueta_juego.set_text(color= c) - self.boton_borrar= JAMButton("Borrar", None) + self.boton_borrar= JAMButton(_("Delete"), None) self.boton_borrar.set_text(tamanio= 30) self.boton_borrar.set_tamanios(tamanio= (50, self.etiqueta_juego.get_tamanio()[1]), grosorbor= 1, espesor= 1) self.boton_borrar.set_colores(colorbas= a, colorbor= b, colorcara= c) - self.boton_load= JAMButton("Cargar", None) + self.boton_load= JAMButton(_("Load"), None) self.boton_load.set_text(tamanio= 30) self.boton_load.set_tamanios(tamanio= (50, self.etiqueta_juego.get_tamanio()[1]), grosorbor= 1, espesor= 1) self.boton_load.set_colores(colorbas= a, colorbor= b, colorcara= c) @@ -598,4 +600,4 @@ class Item_Juego(): def carga_game(self, button= None): self.grupo.juego_base.cargar_juego(self.Archivos_y_Directorios.Leer_Base_de_Datos(self.juego)) - \ No newline at end of file + -- cgit v0.9.1