summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-22 16:51:16 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-22 16:51:16 +0300
commitfb61301d037660e7ff56caa1d49dd2c7c959b15d (patch)
treef115c065616a4c27e2edf08cf4b6d1fb8d96fefb /src
parent61674f9ac09dcba67ad1aad151a5dd179b0f6f9e (diff)
downloadplugin-fb61301d037660e7ff56caa1d49dd2c7c959b15d.tar.gz
plugin-fb61301d037660e7ff56caa1d49dd2c7c959b15d.tar.bz2
plugin-fb61301d037660e7ff56caa1d49dd2c7c959b15d.tar.xz
plugin-fb61301d037660e7ff56caa1d49dd2c7c959b15d.zip
Add support for warn_missing_translation configuration option.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/emap/config.c25
-rw-r--r--src/emap/config.h10
-rw-r--r--src/emap/init.c2
-rw-r--r--src/emap/lang.c3
5 files changed, 41 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c32927f..b7278ac 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,6 +36,8 @@ MAP_SRC = emap/atcommand.c \
emap/battleground.h \
emap/clif.c \
emap/clif.h \
+ emap/config.c \
+ emap/config.h \
emap/craft.c \
emap/craft.h \
emap/craftconf.c \
diff --git a/src/emap/config.c b/src/emap/config.c
new file mode 100644
index 0000000..f6c43ee
--- /dev/null
+++ b/src/emap/config.c
@@ -0,0 +1,25 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/HPMi.h"
+#include "common/memmgr.h"
+#include "common/mapindex.h"
+#include "common/mmo.h"
+#include "common/socket.h"
+#include "common/strlib.h"
+
+#include "ecommon/config.h"
+
+bool warn_missing_translation = false;
+
+void config_warn_missing_translation(const char *key __attribute__ ((unused)),
+ const char *val)
+{
+ warn_missing_translation = config_switch(val) ? true : false;
+}
diff --git a/src/emap/config.h b/src/emap/config.h
new file mode 100644
index 0000000..27117b5
--- /dev/null
+++ b/src/emap/config.h
@@ -0,0 +1,10 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_CONFIG
+#define EVOL_MAP_CONFIG
+
+void config_warn_missing_translation(const char *key, const char *val);
+extern bool warn_missing_translation;
+
+#endif // EVOL_MAP_CONFIG
diff --git a/src/emap/init.c b/src/emap/init.c
index 9a5ca02..5e9deef 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -46,6 +46,7 @@
#include "emap/atcommand.h"
#include "emap/battleground.h"
#include "emap/clif.h"
+#include "emap/config.h"
#include "emap/craft.h"
#include "emap/craftconf.h"
#include "emap/itemdb.h"
@@ -268,6 +269,7 @@ HPExport void server_preinit (void)
addMapInterConf("default_map", config_default_map);
addMapInterConf("default_x", config_default_x);
addMapInterConf("default_y", config_default_y);
+ addMapInterConf("warn_missing_translation", config_warn_missing_translation);
addHookPre("quest->read_db_sub", equest_read_db_sub);
addGroupPermission("send_gm", permission_send_gm_flag);
diff --git a/src/emap/lang.c b/src/emap/lang.c
index e50b50f..60259da 100644
--- a/src/emap/lang.c
+++ b/src/emap/lang.c
@@ -15,6 +15,7 @@
#include "map/npc.h"
#include "map/pc.h"
+#include "emap/config.h"
#include "emap/lang.h"
#include "emap/data/session.h"
#include "emap/struct/sessionext.h"
@@ -175,7 +176,7 @@ const char* lang_trans(const char *str, int lng, int flg)
if (!strings[lng])
{
- if (flg)
+ if (warn_missing_translation && flg)
printf ("no lang string (%s) for: %s\n", lang_langs[lng], str);
return str;
}