- i18n system is in place (requires gettext 0.11.5).

Very few strings are marked as translatable yet...
 - ncurses.cpp: fixed a memory leak
This commit is contained in:
Olivier Teulière 2005-02-06 22:18:11 +00:00
parent b7032e2d78
commit 0032104189
15 changed files with 611 additions and 68 deletions

View file

@ -1,9 +1,17 @@
.*
ABOUT-NLS
intl
m4
core
core.*
gmon.out
configure
config.h
config.h.*
config.guess
config.log
config.cache
config.rpath
config.status
config.sub
Makefile

View file

@ -1,4 +1,5 @@
Eliot ---
Copyright (C) 1999-2000
Eliot ---
Copyright (C) 1999-2005
Main Programmer: Antoine Fraboulet (antoine.fraboulet@free.fr)
Main Programmer: Antoine Fraboulet <antoine.fraboulet@free.fr>
Other: Olivier Teulière <ipkiss@via.ecp.fr>

View file

@ -1,3 +1,10 @@
2005-02-06 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.am (SUBDIRS): Add intl,
(ACLOCAL_AMFLAGS): New variable.
(EXTRA_DIST): New variable.
* configure.in (AC_CONFIG_FILES): Add intl/Makefile,
9 fev 03
- patch Olivier Teulière
- modifications pour wx2.4.0

View file

@ -2,7 +2,8 @@ Installation sous Linux (Un*x) (bien/facile)
------------------------------
* Pour installer à partir de l'archive CVS :
aclocal
autopoint -f
aclocal -I m4
autoheader
automake --add-missing --foreign --copy
autoconf
@ -41,7 +42,8 @@ Dans les 2 cas, les
- si vous utilisez l'archive CVS, il y a quelques commandes préalables
à exécuter (aussi bien sous Cygwin que sous GNU/Linux) :
aclocal
autopoint -f
aclocal -I m4
autoheader
automake --add-missing --foreign --copy
autoconf

View file

@ -1 +1,5 @@
SUBDIRS = dic game utils wxwin
SUBDIRS = intl dic game utils wxwin po
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = config.rpath mkinstalldirs

View file

@ -1,7 +0,0 @@
dnl -----------------------------------------------
dnl custom macros for autoconf script
dnl Author: Antoine Fraboulet
dnl Created: 20.06.99
dnl Version: $Id: acinclude.m4,v 1.1 2004/04/08 09:43:06 afrab Exp $
dnl -----------------------------------------------

View file

@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl --------------------------------------------------------------
dnl configure.in for Eliot
dnl --------------------------------------------------------------
dnl AC_REVISION($Id: configure.in,v 1.6 2005/02/05 11:14:56 ipkiss Exp $)
dnl AC_REVISION($Id: configure.in,v 1.7 2005/02/06 22:18:11 ipkiss Exp $)
AC_INIT(eliot, 1.4)
AC_CONFIG_SRCDIR(wxwin/main.cc)
AM_INIT_AUTOMAKE
@ -64,7 +64,7 @@ dnl --------------------------------------------------------------
dnl Check for wxWidgets
AC_ARG_ENABLE(wxwidgets,
[ --enable-wxwidgets wxWidgets support (default enabled)])
if test "${enable_wxwidgets}" != "no"
if test "${enable_wxwidgets}" = "yes"
then
AM_PATH_WXCONFIG(2.4.0, wxwin=1)
if test "${wxwin}" != 1; then
@ -100,11 +100,14 @@ AC_ARG_ENABLE(text,
[ --enable-text text interface support (default enabled)])
AM_CONDITIONAL([BUILD_TEXT], [test "${enable_text}" != "no"])
dnl internationalization macros
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT
dnl --------------------------------------------------------------
dnl Output
dnl --------------------------------------------------------------
AC_CONFIG_FILES(
AC_CONFIG_FILES(intl/Makefile po/Makefile.in
dic/Makefile
game/Makefile
wxwin/Makefile

10
po/.cvsignore Normal file
View file

@ -0,0 +1,10 @@
Makefile
Makefile.in
Makefile.in.in
POTFILES
*.mo
*.gmo
*.sed
*.sin
*.header
Rules-quot

1
po/LINGUAS Normal file
View file

@ -0,0 +1 @@
fr

25
po/Makevars Normal file
View file

@ -0,0 +1,25 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Eliot
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

56
po/POTFILES.in Normal file
View file

@ -0,0 +1,56 @@
./dic/automaton.c
./dic/automaton.h
./dic/compdic.c
./dic/dic.c
./dic/dic.h
./dic/dic_internals.h
./dic/dic_search.c
./dic/dic_search.h
./dic/hashtable.c
./dic/hashtable.h
./dic/listdic.c
./dic/regexp.c
./dic/regexp.h
./game/bag.cpp
./game/bag.h
./game/board.cpp
./game/board.h
./game/board_cross.cpp
./game/board_search.cpp
./game/cross.cpp
./game/cross.h
./game/debug.h
./game/duplicate.cpp
./game/duplicate.h
./game/freegame.cpp
./game/freegame.h
./game/game.cpp
./game/game.h
./game/gameio.cpp
./game/player.cpp
./game/player.h
./game/pldrack.cpp
./game/pldrack.h
./game/rack.cpp
./game/rack.h
./game/results.cpp
./game/results.h
./game/round.cpp
./game/round.h
./game/tile.cpp
./game/tile.h
./game/training.cpp
./game/training.h
./utils/eliottxt.cpp
./utils/ncurses.cpp
./utils/ncurses.h
./wxwin/auxframes.h
./wxwin/confdimdlg.h
./wxwin/configdb.h
./wxwin/confsearch.h
./wxwin/ewx.h
./wxwin/gfxboard.h
./wxwin/mainframe.h
./wxwin/printout.h
./wxwin/searchpanel.h
./config.h

200
po/eliot.pot Normal file
View file

@ -0,0 +1,200 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Eliot
# 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: 2005-02-06 23:21+0100\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=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: utils/ncurses.cpp:176
msgid " Scores "
msgstr ""
#: utils/ncurses.cpp:182
#, c-format
msgid "Player %d: %d"
msgstr ""
#: utils/ncurses.cpp:190
msgid " Racks "
msgstr ""
#: utils/ncurses.cpp:196
#, c-format
msgid "Player %d: %s"
msgstr ""
#: utils/ncurses.cpp:205 utils/ncurses.cpp:207
msgid "Search complete"
msgstr ""
#: utils/ncurses.cpp:214
msgid " Search results "
msgstr ""
#: utils/ncurses.cpp:243
msgid " History of the game "
msgstr ""
#: utils/ncurses.cpp:250
msgid " N RACK SOLUTION REF PTS P BONUS"
msgstr ""
#: utils/ncurses.cpp:281
msgid " Help "
msgstr ""
#: utils/ncurses.cpp:286
msgid "[Global]"
msgstr ""
#: utils/ncurses.cpp:287
msgid " h, H, ? Show/hide help box"
msgstr ""
#: utils/ncurses.cpp:288
msgid " y, Y Show/hide history of the game"
msgstr ""
#: utils/ncurses.cpp:289
msgid " e, E Show/hide dots on empty squares of the board"
msgstr ""
#: utils/ncurses.cpp:290
msgid " q, Q Quit"
msgstr ""
#: utils/ncurses.cpp:291
msgid " d, D Check the existence of a word in the dictionary"
msgstr ""
#: utils/ncurses.cpp:292
msgid " j, J Play a word"
msgstr ""
#: utils/ncurses.cpp:295
msgid "[Training mode]"
msgstr ""
#: utils/ncurses.cpp:296
msgid " * Take a random rack"
msgstr ""
#: utils/ncurses.cpp:297
msgid " + Complete the current rack randomly"
msgstr ""
#: utils/ncurses.cpp:298
msgid " t, T Set the rack manually"
msgstr ""
#: utils/ncurses.cpp:299
msgid " s, S Search (compute all the possible words)"
msgstr ""
#: utils/ncurses.cpp:300
msgid " r, R Show/hide search results"
msgstr ""
#: utils/ncurses.cpp:303
msgid "[Duplicate mode]"
msgstr ""
#: utils/ncurses.cpp:304
msgid " n, N Switch to the next human player"
msgstr ""
#: utils/ncurses.cpp:307
msgid "[Free game mode]"
msgstr ""
#: utils/ncurses.cpp:308
msgid " p, P Pass your turn (with or without changing letters)"
msgstr ""
#: utils/ncurses.cpp:311
msgid "[Miscellaneous]"
msgstr ""
#: utils/ncurses.cpp:312
msgid " <up>, <down> Navigate in a box line by line"
msgstr ""
#: utils/ncurses.cpp:313
msgid " <pgup>, <pgdown> Navigate in a box page by page"
msgstr ""
#: utils/ncurses.cpp:314
msgid " Ctrl-l Refresh the screen"
msgstr ""
#: utils/ncurses.cpp:322
msgid " Play a word "
msgstr ""
#: utils/ncurses.cpp:323
msgid "Played word:"
msgstr ""
#: utils/ncurses.cpp:324 utils/ncurses.cpp:328
msgid "Coordinates: "
msgstr ""
#: utils/ncurses.cpp:335
msgid "Incorrect or misplaced word"
msgstr ""
#: utils/ncurses.cpp:345
msgid " Dictionary "
msgstr ""
#: utils/ncurses.cpp:346
msgid "Enter the word to check:"
msgstr ""
#: utils/ncurses.cpp:363
msgid " Pass your turn "
msgstr ""
#: utils/ncurses.cpp:364
msgid "Enter the letters to change:"
msgstr ""
#: utils/ncurses.cpp:373
msgid "Cannot pass the turn"
msgstr ""
#: utils/ncurses.cpp:383
msgid " Set rack "
msgstr ""
#: utils/ncurses.cpp:384
msgid "Enter the new letters:"
msgstr ""
#: utils/ncurses.cpp:673
msgid "Training"
msgstr ""
#: utils/ncurses.cpp:675
msgid "Free game"
msgstr ""
#: utils/ncurses.cpp:677
msgid "Duplicate"
msgstr ""
#: utils/ncurses.cpp:733
#, c-format
msgid "Usage: eliotcurses /path/to/ods4.dawg\n"
msgstr ""

204
po/fr.po Normal file
View file

@ -0,0 +1,204 @@
# French translations for eliot package
# Traduction anglaise du package eliot.
# Copyright (C) 2005 Eliot
# This file is distributed under the same license as the eliot package.
# Olivier Teuliere <ipkiss@via.ecp.fr>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: eliot 1.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-02-06 23:21+0100\n"
"PO-Revision-Date: 2005-02-06 20:03+0100\n"
"Last-Translator: Olivier Teuliere <ipkiss@via.ecp.fr>\n"
"Language-Team: French <traduc@traduc.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: utils/ncurses.cpp:176
msgid " Scores "
msgstr " Scores "
#: utils/ncurses.cpp:182
#, c-format
msgid "Player %d: %d"
msgstr "Joueur %d : %d"
#: utils/ncurses.cpp:190
msgid " Racks "
msgstr " Tirages "
#: utils/ncurses.cpp:196
#, c-format
msgid "Player %d: %s"
msgstr "Joueur %d : %s"
#: utils/ncurses.cpp:205 utils/ncurses.cpp:207
msgid "Search complete"
msgstr "Recherche terminée"
#: utils/ncurses.cpp:214
msgid " Search results "
msgstr " Résultats de la recherche "
#: utils/ncurses.cpp:243
msgid " History of the game "
msgstr " Historique de la partie "
#: utils/ncurses.cpp:250
msgid " N RACK SOLUTION REF PTS P BONUS"
msgstr " N TIRAGE SOLUTION REF PTS J BONUS"
#: utils/ncurses.cpp:281
msgid " Help "
msgstr " Aide "
#: utils/ncurses.cpp:286
msgid "[Global]"
msgstr "[General]"
#: utils/ncurses.cpp:287
msgid " h, H, ? Show/hide help box"
msgstr " h, H, ? Afficher/cacher la boîte d'aide"
#: utils/ncurses.cpp:288
msgid " y, Y Show/hide history of the game"
msgstr " y, Y Afficher/cacher l'historique de la partie"
#: utils/ncurses.cpp:289
msgid " e, E Show/hide dots on empty squares of the board"
msgstr ""
" e, E Afficher/cacher les points sur les cases vides du "
"plateau de jeu"
#: utils/ncurses.cpp:290
msgid " q, Q Quit"
msgstr " q, Q Quitter"
#: utils/ncurses.cpp:291
msgid " d, D Check the existence of a word in the dictionary"
msgstr " d, D Vérifier l'existence d'un mot dans le dictionnaire"
#: utils/ncurses.cpp:292
msgid " j, J Play a word"
msgstr " j, J Jouer un mot"
#: utils/ncurses.cpp:295
msgid "[Training mode]"
msgstr "[Mode entraînement]"
#: utils/ncurses.cpp:296
msgid " * Take a random rack"
msgstr " * Tirage aléatoire"
#: utils/ncurses.cpp:297
msgid " + Complete the current rack randomly"
msgstr " + Compléter le tirage courant de manière aléatoire"
#: utils/ncurses.cpp:298
msgid " t, T Set the rack manually"
msgstr " t, T Entrer le tirage manuellement"
#: utils/ncurses.cpp:299
msgid " s, S Search (compute all the possible words)"
msgstr " s, S Rechercher (calculer tous les mots possibles)"
#: utils/ncurses.cpp:300
msgid " r, R Show/hide search results"
msgstr " r, R Afficher/cacher les résultats de la recherche"
#: utils/ncurses.cpp:303
msgid "[Duplicate mode]"
msgstr "[Mode duplicate]"
#: utils/ncurses.cpp:304
msgid " n, N Switch to the next human player"
msgstr " n, N Passer au joueur humain suivant"
#: utils/ncurses.cpp:307
msgid "[Free game mode]"
msgstr "[Mode partir libre]"
#: utils/ncurses.cpp:308
msgid " p, P Pass your turn (with or without changing letters)"
msgstr ""
" p, P Passer son tour (en changeant ou pas certaines lettres)"
#: utils/ncurses.cpp:311
msgid "[Miscellaneous]"
msgstr "[Divers]"
#: utils/ncurses.cpp:312
msgid " <up>, <down> Navigate in a box line by line"
msgstr " <haut>, <bas> Naviguer dans une boîte ligne par ligne"
#: utils/ncurses.cpp:313
msgid " <pgup>, <pgdown> Navigate in a box page by page"
msgstr " <pgup>, <pgdown> Naviguer dans une boîte page par page"
#: utils/ncurses.cpp:314
msgid " Ctrl-l Refresh the screen"
msgstr " Ctrl-l Rafraîchr l'écran"
#: utils/ncurses.cpp:322
msgid " Play a word "
msgstr " Jouer un mot "
#: utils/ncurses.cpp:323
msgid "Played word:"
msgstr "Mot joué :"
#: utils/ncurses.cpp:324 utils/ncurses.cpp:328
msgid "Coordinates: "
msgstr "Coordonnées: "
#: utils/ncurses.cpp:335
msgid "Incorrect or misplaced word"
msgstr "Mot incorrect ou mal placé"
#: utils/ncurses.cpp:345
msgid " Dictionary "
msgstr " Dictionnaire "
#: utils/ncurses.cpp:346
msgid "Enter the word to check:"
msgstr "Entrer le mot à vérifier:"
#: utils/ncurses.cpp:363
msgid " Pass your turn "
msgstr " Passer son tour "
#: utils/ncurses.cpp:364
msgid "Enter the letters to change:"
msgstr "Entrer les lettres à changer:"
#: utils/ncurses.cpp:373
msgid "Cannot pass the turn"
msgstr "Impossible de passer le tour"
#: utils/ncurses.cpp:383
msgid " Set rack "
msgstr " Choix du tirage "
#: utils/ncurses.cpp:384
msgid "Enter the new letters:"
msgstr "Entrer les nouvelles lettres:"
#: utils/ncurses.cpp:673
msgid "Training"
msgstr "Entrainement"
#: utils/ncurses.cpp:675
msgid "Free game"
msgstr "Partie libre"
#: utils/ncurses.cpp:677
msgid "Duplicate"
msgstr "Duplicate"
#: utils/ncurses.cpp:733
#, c-format
msgid "Usage: eliotcurses /path/to/ods4.dawg\n"
msgstr "Usage: eliotcurses /chemin vers/ods4.dawg\n"

View file

@ -16,9 +16,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# $Id: Makefile.am,v 1.2 2005/02/05 11:14:56 ipkiss Exp $
# $Id: Makefile.am,v 1.3 2005/02/06 22:18:11 ipkiss Exp $
INCLUDES = -I$(top_srcdir)/dic -I$(top_srcdir)/game
top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir)/dic -I$(top_srcdir)/game -I$(top_srcdir)/intl
noinst_PROGRAMS =
if BUILD_TEXT
@ -30,7 +32,12 @@ endif
if BUILD_NCURSES
noinst_PROGRAMS += eliotcurses
eliotcurses_SOURCES = ncurses.cpp
eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a
eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a ../intl/libintl.a
# FIXME
AM_LDFLAGS = -lncurses
endif
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@

View file

@ -2,7 +2,7 @@
* Copyright (C) 2005 Eliot
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
* $Id: ncurses.cpp,v 1.1 2005/02/05 11:14:56 ipkiss Exp $
* $Id: ncurses.cpp,v 1.2 2005/02/06 22:18:11 ipkiss Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +19,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
#include "config.h"
#if ENABLE_NLS
# include <libintl.h>
# define _(String) gettext(String)
#else
# define _(String) String
#endif
#include <ctype.h>
#include "ncurses.h"
#include "dic.h"
#include "dic_search.h"
@ -164,13 +173,13 @@ void CursesIntf::drawBoard(WINDOW *win, int y, int x) const
void CursesIntf::drawScoresRacks(WINDOW *win, int y, int x) const
{
drawBox(win, y, x, m_game.getNPlayers() + 2, 25, " Scores ");
drawBox(win, y, x, m_game.getNPlayers() + 2, 25, _(" Scores "));
for (int i = 0; i < m_game.getNPlayers(); i++)
{
if (m_game.getMode() != Game::kTRAINING && i == m_game.currPlayer())
attron(A_BOLD);
mvwprintw(win, y + i + 1, x + 2,
"Player %d: %d", i, m_game.getPlayerPoints(i));
_("Player %d: %d"), i, m_game.getPlayerPoints(i));
if (m_game.getMode() != Game::kTRAINING && i == m_game.currPlayer())
attroff(A_BOLD);
}
@ -178,13 +187,13 @@ void CursesIntf::drawScoresRacks(WINDOW *win, int y, int x) const
// Distance between the 2 boxes
int yOff = m_game.getNPlayers() + 3;
drawBox(win, y + yOff, x, m_game.getNPlayers() + 2, 25, " Racks ");
drawBox(win, y + yOff, x, m_game.getNPlayers() + 2, 25, _(" Racks "));
for (int i = 0; i < m_game.getNPlayers(); i++)
{
if (m_game.getMode() != Game::kTRAINING && i == m_game.currPlayer())
attron(A_BOLD);
mvwprintw(win, y + yOff + i + 1, x + 2,
"Player %d: %s", i, m_game.getPlayerRack(i).c_str());
_("Player %d: %s"), i, m_game.getPlayerRack(i).c_str());
if (m_game.getMode() != Game::kTRAINING && i == m_game.currPlayer())
attroff(A_BOLD);
// Force to refresh the whole rack
@ -193,16 +202,16 @@ void CursesIntf::drawScoresRacks(WINDOW *win, int y, int x) const
// Display a message when the search is complete
if (m_game.getMode() == Game::kTRAINING && m_game.getNResults())
mvwprintw(win, y + 2*yOff - 1, x + 2, "Search complete");
mvwprintw(win, y + 2*yOff - 1, x + 2, _("Search complete"));
else
mvwhline(win, y + 2*yOff - 1, x + 2, ' ', strlen("Search complete"));
mvwhline(win, y + 2*yOff - 1, x + 2, ' ', strlen(_("Search complete")));
}
void CursesIntf::drawResults(WINDOW *win, int y, int x)
{
int h = 17;
drawBox(win, y, x, h, 25, " Search results ");
drawBox(win, y, x, h, 25, _(" Search results "));
m_boxY = y + 1;
m_boxLines = h - 2;
m_boxLinesData = m_game.getNResults();
@ -231,14 +240,14 @@ void CursesIntf::drawHistory(WINDOW *win, int y, int x)
// To allow pseudo-scrolling, without leaving trails
clear();
drawBox(win, y, x, LINES - y, COLS - x, " History of the game ");
drawBox(win, y, x, LINES - y, COLS - x, _(" History of the game "));
m_boxY = y + 1;
m_boxLines = LINES - y - 2;
m_boxLinesData = m_game.getNRounds();
// Heading
boxPrint(win, m_boxStart, x + 2,
" N RACK SOLUTION REF PTS P BONUS");
_(" N RACK SOLUTION REF PTS P BONUS"));
mvwhline(win, y + 2, x + 2, ACS_HLINE, 55);
int i;
@ -248,7 +257,7 @@ void CursesIntf::drawHistory(WINDOW *win, int y, int x)
string word = m_game.getPlayedWord(i);
string coord = m_game.getPlayedCoords(i);
boxPrint(win, i + 2, x + 2,
"%2d %8s %s%s %3s %3d %1²d %c",
"%2d %8s %s%s %3s %3d %1d %c",
i + 1, m_game.getPlayedRack(i).c_str(), word.c_str(),
string(15 - word.size(), ' ').c_str(),
coord.c_str(), m_game.getPlayedPoints(i),
@ -269,40 +278,40 @@ void CursesIntf::drawHelp(WINDOW *win, int y, int x)
// To allow pseudo-scrolling, without leaving trails
clear();
drawBox(win, y, x, LINES - y, COLS - x, " Help ");
drawBox(win, y, x, LINES - y, COLS - x, _(" Help "));
m_boxY = y + 1;
m_boxLines = LINES - y - 2;
int n = 0;
boxPrint(win, n++, x + 2, "[Global]");
boxPrint(win, n++, x + 2, " h, H, ? Show/hide help box");
boxPrint(win, n++, x + 2, " y, Y Show/hide history of the game");
boxPrint(win, n++, x + 2, " e, E Show/hide dots on empty squares of the board");
boxPrint(win, n++, x + 2, " q, Q Quit");
boxPrint(win, n++, x + 2, " d, D Check the existence of a word in the dictionary");
boxPrint(win, n++, x + 2, " j, J Play a word");
boxPrint(win, n++, x + 2, _("[Global]"));
boxPrint(win, n++, x + 2, _(" h, H, ? Show/hide help box"));
boxPrint(win, n++, x + 2, _(" y, Y Show/hide history of the game"));
boxPrint(win, n++, x + 2, _(" e, E Show/hide dots on empty squares of the board"));
boxPrint(win, n++, x + 2, _(" q, Q Quit"));
boxPrint(win, n++, x + 2, _(" d, D Check the existence of a word in the dictionary"));
boxPrint(win, n++, x + 2, _(" j, J Play a word"));
boxPrint(win, n++, x + 2, "");
boxPrint(win, n++, x + 2, "[Training mode]");
boxPrint(win, n++, x + 2, " * Take a random rack");
boxPrint(win, n++, x + 2, " + Complete the current rack randomly");
boxPrint(win, n++, x + 2, " t, T Set the rack manually");
boxPrint(win, n++, x + 2, " s, S Search (compute all the possible words)");
boxPrint(win, n++, x + 2, " r, R Show/hide search results");
boxPrint(win, n++, x + 2, _("[Training mode]"));
boxPrint(win, n++, x + 2, _(" * Take a random rack"));
boxPrint(win, n++, x + 2, _(" + Complete the current rack randomly"));
boxPrint(win, n++, x + 2, _(" t, T Set the rack manually"));
boxPrint(win, n++, x + 2, _(" s, S Search (compute all the possible words)"));
boxPrint(win, n++, x + 2, _(" r, R Show/hide search results"));
boxPrint(win, n++, x + 2, "");
boxPrint(win, n++, x + 2, "[Duplicate mode]");
boxPrint(win, n++, x + 2, " n, N Switch to the next human player");
boxPrint(win, n++, x + 2, _("[Duplicate mode]"));
boxPrint(win, n++, x + 2, _(" n, N Switch to the next human player"));
boxPrint(win, n++, x + 2, "");
boxPrint(win, n++, x + 2, "[Free game mode]");
boxPrint(win, n++, x + 2, " p, P Pass your turn (with or without changing letters)");
boxPrint(win, n++, x + 2, _("[Free game mode]"));
boxPrint(win, n++, x + 2, _(" p, P Pass your turn (with or without changing letters)"));
boxPrint(win, n++, x + 2, "");
boxPrint(win, n++, x + 2, "[Miscellaneous]");
boxPrint(win, n++, x + 2, " <up>, <down> Navigate in a box line by line");
boxPrint(win, n++, x + 2, " <pgup>, <pgdown> Navigate in a box page by page");
boxPrint(win, n++, x + 2, " Ctrl-l Refresh the screen");
boxPrint(win, n++, x + 2, _("[Miscellaneous]"));
boxPrint(win, n++, x + 2, _(" <up>, <down> Navigate in a box line by line"));
boxPrint(win, n++, x + 2, _(" <pgup>, <pgdown> Navigate in a box page by page"));
boxPrint(win, n++, x + 2, _(" Ctrl-l Refresh the screen"));
m_boxLinesData = n;
}
@ -310,20 +319,20 @@ void CursesIntf::drawHelp(WINDOW *win, int y, int x)
void CursesIntf::playWord(WINDOW *win, int y, int x)
{
drawBox(win, y, x, 4, 32, " Play a word ");
mvwprintw(win, y + 1, x + 2, "Played word:");
mvwprintw(win, y + 2, x + 2, "Coordinates:");
drawBox(win, y, x, 4, 32, _(" Play a word "));
mvwprintw(win, y + 1, x + 2, _("Played word:"));
mvwprintw(win, y + 2, x + 2, _("Coordinates: "));
wrefresh(win);
string word, coord;
int xOff = strlen("Coordinates: ") + 2;
int xOff = strlen(_("Coordinates: ")) + 2;
if (readString(win, y + 1, x + xOff, 15, word) &&
readString(win, y + 2, x + xOff, 3, coord))
{
int res = m_game.play(coord, word);
if (res)
{
drawStatus(win, LINES - 1, 0, "Incorrect or misplaced word");
drawStatus(win, LINES - 1, 0, _("Incorrect or misplaced word"));
}
}
m_state = DEFAULT;
@ -333,8 +342,8 @@ void CursesIntf::playWord(WINDOW *win, int y, int x)
void CursesIntf::checkWord(WINDOW *win, int y, int x)
{
drawBox(win, y, x, 4, 32, " Dictionary ");
mvwprintw(win, y + 1, x + 2, "Enter the word to check:");
drawBox(win, y, x, 4, 32, _(" Dictionary "));
mvwprintw(win, y + 1, x + 2, _("Enter the word to check:"));
wrefresh(win);
string word;
@ -351,8 +360,8 @@ void CursesIntf::checkWord(WINDOW *win, int y, int x)
void CursesIntf::passTurn(WINDOW *win, int y, int x, FreeGame &iGame)
{
drawBox(win, y, x, 4, 32, " Pass your turn ");
mvwprintw(win, y + 1, x + 2, "Enter the letters to change:");
drawBox(win, y, x, 4, 32, _(" Pass your turn "));
mvwprintw(win, y + 1, x + 2, _("Enter the letters to change:"));
wrefresh(win);
string letters;
@ -361,7 +370,7 @@ void CursesIntf::passTurn(WINDOW *win, int y, int x, FreeGame &iGame)
int res = iGame.pass(letters, m_game.currPlayer());
if (res)
{
drawStatus(win, LINES - 1, 0, "Cannot pass the turn");
drawStatus(win, LINES - 1, 0, _("Cannot pass the turn"));
}
}
m_state = DEFAULT;
@ -371,8 +380,8 @@ void CursesIntf::passTurn(WINDOW *win, int y, int x, FreeGame &iGame)
void CursesIntf::setRack(WINDOW *win, int y, int x, Training &iGame)
{
drawBox(win, y, x, 4, 32, " Set rack ");
mvwprintw(win, y + 1, x + 2, "Enter the new letters:");
drawBox(win, y, x, 4, 32, _(" Set rack "));
mvwprintw(win, y + 1, x + 2, _("Enter the new letters:"));
wrefresh(win);
string letters;
@ -661,11 +670,11 @@ void CursesIntf::redraw(WINDOW *win)
attron(A_REVERSE);
string mode;
if (m_game.getMode() == Game::kTRAINING)
mode = "Training";
mode = _("Training");
else if (m_game.getMode() == Game::kFREEGAME)
mode = "Free game";
mode = _("Free game");
else if (m_game.getMode() == Game::kDUPLICATE)
mode = "Duplicate";
mode = _("Duplicate");
string title = "Eliot (" + mode + " mode) [h for help]";
mvwprintw(win, 0, 0, title.c_str());
whline(win, ' ', COLS - title.size());
@ -677,6 +686,17 @@ void CursesIntf::redraw(WINDOW *win)
int main(int argc, char ** argv)
{
#ifdef HAVE_SETLOCALE
// Set locale via LC_ALL
setlocale(LC_ALL, "");
#endif
#if ENABLE_NLS
// Set the message domain
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
// Initialize the ncurses library
WINDOW *wBoard = initscr();
keypad( wBoard, true );
@ -710,7 +730,7 @@ int main(int argc, char ** argv)
if (argc != 2)
{
endwin();
fprintf(stdout, "Usage: eliotcurses /chemin/vers/ods4.dawg\n");
fprintf(stdout, _("Usage: eliotcurses /path/to/ods4.dawg\n"));
exit(1);
}
else
@ -740,6 +760,8 @@ int main(int argc, char ** argv)
}
}
Dic_destroy(dic);
delwin(wBoard);
// Exit the ncurses library