diff --git a/changelog b/changelog index 6ab491595f6..bdfe7e02b78 100644 --- a/changelog +++ b/changelog @@ -51,6 +51,7 @@ CVS HEAD: * fix sign glitch in The Rise of Wesnoth * fix map in 'A New Land' in The Rise of Wesnoth * code cleanups + * remove obsolete tools: make_translation merge_translations * remove old unused images: * time-of-day diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am index d4bbec957df..ec982e7b2bd 100644 --- a/src/tools/Makefile.am +++ b/src/tools/Makefile.am @@ -1,61 +1,16 @@ - -bin_PROGRAMS = make_translation merge_translations - -if LIBPNG -bin_PROGRAMS += exploder cutter -endif - -############################################################################# -# Translation Tools # -############################################################################# - -AM_CXXFLAGS = @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" -I../ \ - -DLOCALEDIR=\"$(LOCALEDIR)\" -AM_LDFLAGS = @SDL_LIBS@ - -if LIBPNG - AM_CXXFLAGS += @PNG_CFLAGS@ -endif - -############################################################################# -# Make Translation # -############################################################################# - -make_translation_SOURCES = make_translation.cpp \ - ../config.cpp \ - ../filesystem.cpp \ - ../game_config.cpp \ - ../log.cpp \ - ../server/variable.cpp \ - ../config.hpp \ - ../filesystem.hpp \ - ../game_config.hpp \ - ../log.hpp \ - ../gettext.cpp - - -############################################################################# -# Merge Translations # -############################################################################# - -merge_translations_SOURCES = merge_translations.cpp \ - ../config.cpp \ - ../filesystem.cpp \ - ../game_config.cpp \ - ../log.cpp \ - ../server/variable.cpp \ - ../config.hpp \ - ../filesystem.hpp \ - ../game_config.hpp \ - ../log.hpp \ - ../gettext.cpp - ############################################################################# # Castle building helpers # ############################################################################# if LIBPNG +bin_PROGRAMS = exploder cutter + +AM_CXXFLAGS = @SDL_CFLAGS@ @PNG_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" -I../ \ + -DLOCALEDIR=\"$(LOCALEDIR)\" +AM_LDFLAGS = @SDL_LIBS@ + + exploder_SOURCES = exploder.cpp \ exploder_utils.cpp \ exploder_cutter.cpp \ @@ -92,4 +47,3 @@ exploder_LDFLAGS = @SDL_LIBS@ @SDL_IMAGE_LIBS@ @PNG_LIBS@ cutter_LDFLAGS = @SDL_LIBS@ @SDL_IMAGE_LIBS@ @PNG_LIBS@ endif - diff --git a/src/tools/make_translation.cpp b/src/tools/make_translation.cpp deleted file mode 100644 index 23ab5c3e52e..00000000000 --- a/src/tools/make_translation.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* $Id$ */ -/* - Copyright (C) 2003 by David White - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY. - - See the COPYING file for more details. -*/ -#include -#include -#include -#include -#include - -#include "config.hpp" - -using namespace std; - -void process_config(const std::string& element_name, const config& cfg, - std::map& out) -{ - typedef std::pair pair; - - for(config::child_map::const_iterator i = cfg.all_children().begin(); i != cfg.all_children().end(); ++i) { - for(vector::const_iterator j = i->second.begin(); - j != i->second.end(); ++j) { - process_config(i->first,**j,out); - } - } - - const map& table = cfg.values; - const map::const_iterator id = table.find("id"); - - if(element_name == "campaign") { - const map::const_iterator name = table.find("name"); - const map::const_iterator diff = table.find("difficulty_descriptions"); - if(name != table.end()) { - out.insert(std::pair(id->second,name->second)); - } - - if(diff != table.end()) { - out.insert(std::pair(id->second + "_difficulties",diff->second)); - } - } - else if(element_name == "message" || element_name=="option" ) { - const map::const_iterator msg = table.find("message"); - - if(id == table.end()) { - static const std::string dummy; - const std::string& text = msg != table.end() ? msg->second:dummy; - std::cerr << "message found with no id: " << text << "\n"; - return; - } - - if(msg == table.end()) { - std::cerr << "message found with no text\n"; - return; - } - - out.insert(std::pair(id->second,msg->second)); - } else if(element_name == "part") { - const map::const_iterator msg = table.find("story"); - if(id == table.end() || msg == table.end()) { - return; - } - - out.insert(std::pair(id->second,msg->second)); - } else if(element_name == "multiplayer" || element_name == "scenario") { - map::const_iterator msg = table.find("name"); - if(id == table.end() || msg == table.end()) { - return; - } - - out.insert(std::pair(id->second,msg->second)); - - if(element_name == "scenario") { - msg = table.find("objectives"); - if(msg != table.end()) { - out.insert(std::pair(id->second + "_objectives", - msg->second)); - } - } - } else if(element_name == "language") { - const map::const_iterator name = table.find("language"); - if(name != table.end() && name->second == "English") { - for(map::const_iterator i = table.begin(); - i != table.end(); ++i) { - if(i->first != "language") { - out.insert(*i); - } - } - } - } else if(element_name == "unit") { - const map::const_iterator name_it = table.find("name"); - if(name_it == table.end()) { - return; - } - - std::string name = name_it->second; - name.erase(std::remove(name.begin(),name.end(),' '),name.end()); - - out.insert(std::pair(name,name_it->second)); - - const map::const_iterator description_it = - table.find("unit_description"); - if(description_it != table.end()) { - out.insert(std::pair(name + "_description", - description_it->second)); - } - - const map::const_iterator ability_it = - table.find("ability"); - if(ability_it != table.end()) { - out.insert(pair("ability_" + ability_it->second, - ability_it->second)); - } - } else if(element_name == "attack") { - const map::const_iterator name_it=table.find("name"); - const map::const_iterator type_it=table.find("type"); - const map::const_iterator spec_it=table.find("special"); - if(name_it == table.end() || type_it == table.end()) { - return; - } - - out.insert(pair("weapon_name_" + name_it->second,name_it->second)); - out.insert(pair("weapon_type_" + type_it->second,type_it->second)); - - if(spec_it == table.end()) { - return; - } - - out.insert(pair("weapon_special_" + spec_it->second,spec_it->second)); - } -} - -int main() -{ - const std::string difficulties[3] = { "EASY", "NORMAL", "HARD" }; - map table; - - for (int i = 0; i < 3; i++) { - preproc_map defines; - defines[difficulties[i]] = preproc_define(); - - config cfg(preprocess_file("data/game.cfg", &defines) + "\n" + preprocess_file("data/translations/", &defines)); - - process_config("",cfg,table); - } - - std::cout << "[language]\n\tlanguage=\"Language Name Goes Here\"\n" << - "id=en #language code - English=en, French=fr, etc\n"; - for(map::const_iterator i = table.begin(); - i != table.end(); ++i) { - std::cout << "\t" << i->first << "=\"" << i->second << "\"\n"; - } - std::cout << "[/language]\n"; - - return 0; -} diff --git a/src/tools/merge_translations.cpp b/src/tools/merge_translations.cpp deleted file mode 100644 index 168b060b99e..00000000000 --- a/src/tools/merge_translations.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* $Id$ */ -/* - Copyright (C) 2003 by David White - Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY. - - See the COPYING file for more details. -*/ -#include -#include -#include - -#include "config.hpp" - -int main(int argc, char** argv) -{ - if(argc != 3) { - std::cerr << "Usage: " << argv[0] - << " translation default-translation\n"; - return 0; - } - - const std::string& data1 = read_file(argv[1]); - const std::string& data2 = read_file(argv[2]); - - if(data1.empty()) { - std::cerr << "Could not read '" << argv[1] << "'\n"; - return 0; - } - - if(data2.empty()) { - std::cerr << "Could not read '" << argv[2] << "'\n"; - return 0; - } - - config cfg; - - try { - cfg.read(data1); - } catch(config::error& e) { - std::cerr << "error parsing '" << argv[1] << "': " << e.message << "\n"; - return 0; - } - - config::child_list translations = cfg.get_children("language"); - if(translations.empty()) { - std::cerr << "no translation data found in '" << argv[1] << "'\n"; - return 0; - } - - if(translations.size() > 1) { - std::cerr << "warning: found multiple translations in '" << argv[1] - << "'\n"; - } - - const std::map strings = translations[0]->values; - - try { - cfg.read(data2); - } catch(config::error& e) { - std::cerr << "error parsing '" << argv[2] << "': " << e.message << "\n"; - return 0; - } - - translations = cfg.get_children("language"); - if(translations.empty()) { - std::cerr << "no translation data found in '" << argv[2] << "'\n"; - return 0; - } - - if(translations.size() > 1) { - std::cerr << "warning: found multiple translations in '" << argv[2] - << "'\n"; - } - - const std::map default_strings = - translations[0]->values; - - std::cout << "[language]\n\n" - << "#strings that were not found in the translation, \n" - << "#and which should be translated now:\n"; - - for(std::map::const_iterator i = - default_strings.begin(); i != default_strings.end(); ++i) { - if(strings.find(i->first) == strings.end()) { - std::cout << i->first << "=\"" << i->second << "\"\n"; - } - } - - std::cout << "\n#---------------------------------" - << "\n#strings that have already been translated\n"; - - for(std::map::const_iterator i = strings.begin(); - i != strings.end(); ++i) { - std::cout << i->first << "=\"" << i->second << "\"\n"; - } - - std::cout << "[/language]\n"; - return 0; -}