/**********************************************************************
 *
 *   FreeDoko a Doppelkopf-Game
 *    
 *   Copyright (C) 2001-2004  by Diether Knof and Borg Enders
 *
 *   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 the Free Software Foundation; either version 2 of 
 *   the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details. 
 *   You can find this license in the file 'gpl.txt'.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 *   MA  02111-1307  USA
 *
 *  Contact:
 *    Diether Knof dknof@gmx.de
 *    Borg Enders  borg@borgsoft.de
 *
 *********************************************************************/

#ifndef CLASS_LANGUAGE_HEADER
#define CLASS_LANGUAGE_HEADER

#define USE_TRANSLATOR

#ifdef USE_TRANSLATOR
#include "translator.h"

typedef Translator Language;
extern Translator language;

#else // #ifdef USE_TRANSLATOR

#include "../basistypes.h"

#include "../card/card.h"

#include "../party/rule.h"
#include "../game/game.h"
#include "../player/player.h"
#include "../player/aiconfig.h"

class Language {
  public:
    static vector<string> directories;
    static vector<string> names;

    static void dir_scan();
    static void dir_scan(string const& dirname);

  public:

    Language();
    Language(Language const& language);
    Language& operator=(Language const& language);

    ~Language();

    string const& name() const;
    string const& token() const;

    string operator()(string const& text) const;
    string operator()(char const* const text, ...) const;

    string operator()(Card::Value const& value) const;
    string operator()(Card::TColor const& tcolor) const;
    string operator()(Card const& card) const;

    string operator()(Rule::TypeBool const& type) const;
    string operator()(Rule::TypeUnsigned const& type) const;

    string operator()(Team const& team) const;
    string operator()(GameType const& game_type) const;
    string operator()(Announcement const& announcement) const;
    string operator()(MarriageSelector const& marriage_selector) const;
    string operator()(Specialpoint const& special_point) const;

    string operator()(Player::Type const& type) const;
    string operator()(AiType const& aitype) const;

    Language& load();
    Language& load(string filename);
    void update();

    ostream& output(ostream& ostr) const;

  private:
    string name_p;
    vector<string> word_p;
    vector<string> translation_p;
}; // class Language

ostream& operator<<(ostream& ostr, Language const& language);

extern Language language;
#endif // #ifdef USE_TRANSLATOR

#endif // #ifndef CLASS_LANGUAGE_HEADER
