Remove obsolete tools.
This commit is contained in:
parent
8a4b504007
commit
7459db00c8
4 changed files with 8 additions and 320 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2003 by David White <davidnwhite@optusnet.com.au>
|
||||
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 <algorithm>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "config.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void process_config(const std::string& element_name, const config& cfg,
|
||||
std::map<std::string,std::string>& out)
|
||||
{
|
||||
typedef std::pair<string,string> pair;
|
||||
|
||||
for(config::child_map::const_iterator i = cfg.all_children().begin(); i != cfg.all_children().end(); ++i) {
|
||||
for(vector<config*>::const_iterator j = i->second.begin();
|
||||
j != i->second.end(); ++j) {
|
||||
process_config(i->first,**j,out);
|
||||
}
|
||||
}
|
||||
|
||||
const map<string,string>& table = cfg.values;
|
||||
const map<string,string>::const_iterator id = table.find("id");
|
||||
|
||||
if(element_name == "campaign") {
|
||||
const map<string,string>::const_iterator name = table.find("name");
|
||||
const map<string,string>::const_iterator diff = table.find("difficulty_descriptions");
|
||||
if(name != table.end()) {
|
||||
out.insert(std::pair<string,string>(id->second,name->second));
|
||||
}
|
||||
|
||||
if(diff != table.end()) {
|
||||
out.insert(std::pair<string,string>(id->second + "_difficulties",diff->second));
|
||||
}
|
||||
}
|
||||
else if(element_name == "message" || element_name=="option" ) {
|
||||
const map<string,string>::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<string,string>(id->second,msg->second));
|
||||
} else if(element_name == "part") {
|
||||
const map<string,string>::const_iterator msg = table.find("story");
|
||||
if(id == table.end() || msg == table.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
out.insert(std::pair<string,string>(id->second,msg->second));
|
||||
} else if(element_name == "multiplayer" || element_name == "scenario") {
|
||||
map<string,string>::const_iterator msg = table.find("name");
|
||||
if(id == table.end() || msg == table.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
out.insert(std::pair<string,string>(id->second,msg->second));
|
||||
|
||||
if(element_name == "scenario") {
|
||||
msg = table.find("objectives");
|
||||
if(msg != table.end()) {
|
||||
out.insert(std::pair<string,string>(id->second + "_objectives",
|
||||
msg->second));
|
||||
}
|
||||
}
|
||||
} else if(element_name == "language") {
|
||||
const map<string,string>::const_iterator name = table.find("language");
|
||||
if(name != table.end() && name->second == "English") {
|
||||
for(map<string,string>::const_iterator i = table.begin();
|
||||
i != table.end(); ++i) {
|
||||
if(i->first != "language") {
|
||||
out.insert(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(element_name == "unit") {
|
||||
const map<string,string>::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<string,string>(name,name_it->second));
|
||||
|
||||
const map<string,string>::const_iterator description_it =
|
||||
table.find("unit_description");
|
||||
if(description_it != table.end()) {
|
||||
out.insert(std::pair<string,string>(name + "_description",
|
||||
description_it->second));
|
||||
}
|
||||
|
||||
const map<string,string>::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<string,string>::const_iterator name_it=table.find("name");
|
||||
const map<string,string>::const_iterator type_it=table.find("type");
|
||||
const map<string,string>::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<string,string> 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<string,string>::const_iterator i = table.begin();
|
||||
i != table.end(); ++i) {
|
||||
std::cout << "\t" << i->first << "=\"" << i->second << "\"\n";
|
||||
}
|
||||
std::cout << "[/language]\n";
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2003 by David White <davidnwhite@optusnet.com.au>
|
||||
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 <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#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<std::string,std::string> 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<std::string,std::string> 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<std::string,std::string>::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<std::string,std::string>::const_iterator i = strings.begin();
|
||||
i != strings.end(); ++i) {
|
||||
std::cout << i->first << "=\"" << i->second << "\"\n";
|
||||
}
|
||||
|
||||
std::cout << "[/language]\n";
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue