Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README_ES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TRANSALTION TO SPANISH LANGUAGE
you should follow the following steps.

1.INSTALL gettext

http://archive.linuxfromscratch.org/lfs-museum/5.1-pre1/LFS-BOOK-5.1-PRE1-HTML/chapter06/gettext.html

2.

# xgettext --keyword=_ --language=C --add-comments --sort-output -o main.pot main.cpp

3.

# msginit -l es_AR.UTF-8 -o traslate/es_AR/main.po -i main.pot

4.

# msgfmt -c -v -o traslate/es_AR/main.mo traslate/es_AR/main.po

5.
# sudo cp -v main.mo /usr/share/locale/es_AR/LC_MESSAGES/
6.

Insert the following lines in all the functions that there is text on

setlocale(LC_ALL, "");

bindtextdomain("main", "/usr/share/locale");

textdomain("main");
80 changes: 57 additions & 23 deletions Ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>

#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#define _(STRING) gettext(STRING)

using namespace std;
using namespace boost;


namespace Bastet{

Score &operator +=(Score &a, const Score &b){
Expand Down Expand Up @@ -111,13 +118,18 @@ namespace Bastet{
}

Curses::Curses(){

setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");

if(initscr()==NULL){
fprintf(stderr,"bastet: error while initializing graphics (ncurses library).\n");
fprintf(stderr,(_("bastet: error while initializing graphics (ncurses library).\n")));
exit(1);
}
if(!has_colors()){
endwin();
fprintf(stderr,"bastet: no color support, sorry. Ask the author for a black and white version.");
fprintf(stderr,(_("bastet: no color support, sorry. Ask the author for a black and white version.")));
exit(1);
}

Expand Down Expand Up @@ -302,22 +314,28 @@ namespace Bastet{
}

void Ui::RedrawStatic(){

setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");


erase();
wrefresh(stdscr);
_wellWin.RedrawBorder();
_nextWin.RedrawBorder();
_scoreWin.RedrawBorder();

wattrset((WINDOW*)_nextWin,COLOR_PAIR(17));
mvwprintw(_nextWin,0,0," Next block:");
mvwprintw(_nextWin,0,0,_(" Next block:"));
wrefresh(_nextWin);

wattrset((WINDOW*)_scoreWin,COLOR_PAIR(17));
mvwprintw(_scoreWin,1,0,"Score:");
mvwprintw(_scoreWin,1,0,_("Score:"));
wattrset((WINDOW*)_scoreWin,COLOR_PAIR(18));
mvwprintw(_scoreWin,3,0,"Lines:");
mvwprintw(_scoreWin,3,0,_("Lines:"));
wattrset((WINDOW*)_scoreWin,COLOR_PAIR(19));
mvwprintw(_scoreWin,5,0,"Level:");
mvwprintw(_scoreWin,5,0,_("Level:"));
wrefresh(_scoreWin);
}

Expand All @@ -333,6 +351,10 @@ namespace Bastet{

time.tv_sec=0;
time.tv_usec=delay[_level];

setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");

//assumes nodelay(stdscr,TRUE) has already been called
BlockPosition p;
Expand Down Expand Up @@ -376,7 +398,7 @@ namespace Bastet{
break;
}
else if(ch==keys->Pause){
MessageDialog("Press SPACE or ENTER to resume the game");
MessageDialog(_("Press SPACE or ENTER to resume the game"));
RedrawStatic();
RedrawWell(w,b,p);
nodelay(stdscr,TRUE);
Expand Down Expand Up @@ -511,25 +533,32 @@ namespace Bastet{

void Ui::HandleHighScores(difficulty_t diff){
HighScores *hs=config.GetHighScores(diff);
setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");

if(hs->Qualifies(_points)){
string name=InputDialog(" Congratulations! You got a high score \n Please enter your name");
string name=InputDialog(_(" Congratulations! You got a high score \n Please enter your name"));
hs->InsertHighScore(_points,name);
}else{
MessageDialog("You did not get into\n"
"the high score list!\n"
"\n"
" Try again!\n"
);
MessageDialog((_(" You did not get into \n the high score list! \n \n Try again!\n")));/*_("You did not get into\n"
"the high score list! \n"
"\n"
" Try again!\n"
));*/
}
}

void Ui::ShowHighScores(difficulty_t diff){
HighScores *hs=config.GetHighScores(diff);
string allscores;
setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");
if(diff==difficulty_normal)
allscores+="**Normal difficulty**\n";
allscores+=(_("**Normal difficulty**\n"));
else if(diff==difficulty_hard)
allscores+="**Hard difficulty**\n";
allscores+=(_("**Hard difficulty**\n"));
format fmt("%-20.20s %8d\n");
for(HighScores::reverse_iterator it=hs->rbegin();it!=hs->rend();++it){
allscores+=str(fmt % it->Scorer % it->Score);
Expand All @@ -539,15 +568,20 @@ namespace Bastet{

void Ui::CustomizeKeys(){
Keys *keys=config.GetKeys();
setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");
string traslate = _("Press the key you wish to use for:"); /* content is passed to the variable traslate to use the translation function */

format fmt(
"Press the key you wish to use for:\n\n"
traslate + "\n\n"
"%=1.34s\n\n");
keys->Down=KeyDialog(str(fmt % "move tetromino DOWN (soft-drop)"));
keys->Left=KeyDialog(str(fmt % "move tetromino LEFT"));
keys->Right=KeyDialog(str(fmt % "move tetromino RIGHT"));
keys->RotateCW=KeyDialog(str(fmt % "rotate tetromino CLOCKWISE"));
keys->RotateCCW=KeyDialog(str(fmt % "rotate tetromino COUNTERCLOCKWISE"));
keys->Drop=KeyDialog(str(fmt % "DROP tetromino (move down as much as possible immediately)"));
keys->Pause=KeyDialog(str(fmt % "PAUSE the game"));
keys->Down=KeyDialog(str(fmt % _("move tetromino DOWN (soft-drop)")));
keys->Left=KeyDialog(str(fmt % _("move tetromino LEFT")));
keys->Right=KeyDialog(str(fmt % _("move tetromino RIGHT")));
keys->RotateCW=KeyDialog(str(fmt % _("rotate tetromino CLOCKWISE")));
keys->RotateCCW=KeyDialog(str(fmt % _("rotate tetromino COUNTERCLOCKWISE")));
keys->Drop=KeyDialog(str(fmt % _("DROP tetromino (move down as much as possible immediately)")));
keys->Pause=KeyDialog(str(fmt % _("PAUSE the game")));
}
}
14 changes: 13 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,29 @@
#include <iostream>
#include <boost/format.hpp>

#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#define _(STRING) gettext(STRING)

using namespace Bastet;
using namespace std;
using namespace boost;
using namespace boost::assign;


int main(int argc, char **argv){

setlocale(LC_ALL, "");
bindtextdomain("main", "/usr/share/locale");
textdomain("main");

Ui ui;
while(1){

int choice=ui.MenuDialog(list_of("Play! (normal version)")("Play! (harder version)")("View highscores")("Customize keys")("Quit"));
int choice=ui.MenuDialog(list_of(_("Play! (normal version)"))(_("Play! (harder version)"))(_("View highscores"))(_("Customize keys"))(_("Quit")));

switch(choice){
case 0:{
//ui.ChooseLevel();
Expand Down
38 changes: 38 additions & 0 deletions main.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 19:31-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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: main.cpp:49
msgid "Customize keys"
msgstr ""

#: main.cpp:49
msgid "Play! (harder version)"
msgstr ""

#: main.cpp:49
msgid "Play! (normal version)"
msgstr ""

#: main.cpp:49
msgid "Quit"
msgstr ""

#: main.cpp:49
msgid "View highscores"
msgstr ""
Binary file added traslate/es_AR/main.mo
Binary file not shown.
120 changes: 120 additions & 0 deletions traslate/es_AR/main.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Spanish translations for PACKAGE package
# Traducciones al español para el paquete PACKAGE.
# Copyright (C) 2018 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# facundo <facundo@vigo>, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 19:31-0300\n"
"PO-Revision-Date: 2018-05-05 19:31-0300\n"
"Last-Translator: facundo <facundo@vigo>\n"
"Language-Team: Argentinian\n"
"Language: es_AR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: main.cpp:49
msgid "Customize keys"
msgstr "Personalizar claves"

#: main.cpp:49
msgid "Play! (harder version)"
msgstr "Jugar! (version dificil)"

#: main.cpp:49
msgid "Play! (normal version)"
msgstr "Jugar! (version normal)"

#: main.cpp:49
msgid "Quit"
msgstr "Salir"

#: main.cpp:49
msgid "View highscores"
msgstr "Ver mejores puntuaciones"

#: Ui.cpp:127
msgid "bastet: error while initializing graphics (ncurses library).\n"
msgstr "bastet: error al inicializar gráficos (biblioteca ncurses).\n"

#:Ui.cpp:132
msgid "bastet: no color support, sorry. Ask the author for a black and white version."
msgstr "bastet: sin soporte de color, lo siento. Pidale al autor una versión en blanco y negro."

#: Ui.cpp:330
msgid " Next block:"
msgstr "proxima pieza:"

#: Ui.cpp:3334
msgid "Score:"
msgstr "Puntos:"

#: Ui.cpp:336
msgid "Lines:"
msgstr "Lineas:"

#: Ui.cpp:338
msgid "Level:"
msgstr "Nivel:"

#: Ui.cpp:401
msgid "Press SPACE or ENTER to resume the game"
msgstr "Presione SPACE o ENTER para reanudar el juego"

#:Ui.cpp:544
msgid " You did not get into \n the high score list! \n \n Try again!\n"
msgstr " No ingresaste en la lista de puntajes altos! \n \n Intentalo de nuevo! \n"

#: Ui.cpp:541
msgid " Congratulations! You got a high score \n Please enter your name"
msgstr " Felicitaciones! Obtuviste puntaje alto, por favor ingresa tu nombre"

#: Ui.cpp:559
msgid "**Normal difficulty**\n"
msgstr "**Dificultad Normal**\n"

#: Ui.cpp:561
msgid "**Hard difficulty**\n"
msgstr "**Dificultad Dificil**\n"

#: Ui.cpp:574
msgid "Press the key you wish to use for:"
msgstr "Presione la tecla que desea usar para:"

#: Ui.cpp:579
msgid "move tetromino DOWN (soft-drop)"
msgstr "mover tetromino ABAJO (suave)"

#: Ui.cpp:580
msgid "move tetromino LEFT"
msgstr "mover tetromino IZQUIERDA"

#: Ui.cpp:581
msgid "move tetromino RIGHT"
msgstr "mover tetromino DERECHA"

#: Ui.cpp:582
msgid "rotate tetromino CLOCKWISE"
msgstr "rotar tetromino AGUJAS DEL RELOJ"

#: Ui.cpp:583
msgid "rotate tetromino COUNTERCLOCKWISE"
msgstr "rotar tetromino SENTIDO CONTRARIO AGUJAS DEL RELOJ"

#: Ui.cpp:584
msgid "DROP tetromino (move down as much as possible immediately)"
msgstr "SOLTAR tetromino (Bajar Rapido)"

#: Ui.cpp:585
msgid "PAUSE the game"
msgstr "PAUSA del Juego"





Loading