1
0
forked from 0ad/0ad

Made tinygettext’s debug output optional

You can now enable tinygettext’s output from the user.cfg file
(tinygettext.debug).
This enhancement also solved a warning due to the previous workaround,
which was
to uncomment the output line to avoid the debug messages.

This issue was reported by Yves at Github:
https://github.com/leper/0ad/issues/10

This was SVN commit r15002.
This commit is contained in:
Adrián Chaves 2014-04-26 15:32:18 +00:00
parent baf04bad53
commit 8fea36cdd0
4 changed files with 16 additions and 1 deletions

View File

@ -332,6 +332,9 @@ profiler2.gpu.intel.enable = true ; Allow GL_INTEL_performance_queries
; > JS DEBUGGER
jsdebugger.enable = false ; Enable Javascript debugging. The Debugger is currently broken and can't be enabled until the SpiderMonkey upgrade is done and the debugger is updated for the new API.
; > TINYGETTEXT DEBUGGING
tinygettext.debug = false ; Enable Tinygettext debugging information. If true, Tinygettext prints error messages each time that a translation for an English string is not found.
; > QUICKSAVE
hotkey.quicksave = "Shift+F5"
hotkey.quickload = "Shift+F8"

View File

@ -45,6 +45,17 @@ L10n& L10n::Instance()
L10n::L10n()
: currentLocaleIsOriginalGameLocale(false), useLongStrings(false), dictionary(new tinygettext::Dictionary())
{
// Determine whether or not to print tinygettext messages to the standard
// error output, which it tinygettext’s default behavior, but not ours.
bool tinygettext_debug = false;
CFG_GET_VAL("tinygettext.debug", Bool, tinygettext_debug);
if (!tinygettext_debug)
{
tinygettext::Log::log_info_callback = 0;
tinygettext::Log::log_warning_callback = 0;
tinygettext::Log::log_error_callback = 0;
}
LoadListOfAvailableLocales();
ReevaluateCurrentLocaleAndReload();
}

View File

@ -35,6 +35,7 @@
#include <tinygettext/tinygettext.hpp>
#include <tinygettext/po_parser.hpp>
#include <tinygettext/log.hpp>
#if MSC_VERSION
# pragma warning(pop)

View File

@ -29,7 +29,7 @@ Log::log_callback_t Log::log_error_callback = &Log::default_log_callback;
void
Log::default_log_callback(const std::string& str)
{
// std::cerr << "tinygettext: " << str;
std::cerr << "tinygettext: " << str;
}
void