summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-18 22:09:31 +0200
committerwm4 <wm4@nowhere>2013-10-18 22:38:10 +0200
commite046fa584a5fd695e652570725cab5eb6ef5c17d (patch)
tree83818adb14ef535316910f833dd1083d3d2e54f2 /mpvcore
parentfd0ffa7b40b8b2fa038e5748cadda35092530a49 (diff)
downloadmpv-e046fa584a5fd695e652570725cab5eb6ef5c17d.tar.bz2
mpv-e046fa584a5fd695e652570725cab5eb6ef5c17d.tar.xz
mp_msg: remove gettext() support
Was disabled by default, was never used, internal support was inconsistent and poor, and there has been virtually no interest in creating translations. And I don't even think that a terminal program should be translated. This is something for (hypothetical) GUIs.
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/mp_msg.c82
-rw-r--r--mpvcore/mp_msg.h6
2 files changed, 2 insertions, 86 deletions
diff --git a/mpvcore/mp_msg.c b/mpvcore/mp_msg.c
index 3f073bf919..0284f2a2cb 100644
--- a/mpvcore/mp_msg.c
+++ b/mpvcore/mp_msg.c
@@ -30,11 +30,6 @@
#include "osdep/getch2.h"
#include "osdep/io.h"
-#ifdef CONFIG_GETTEXT
-#include <locale.h>
-#include <libintl.h>
-#endif
-
#ifndef __MINGW32__
#include <signal.h>
#endif
@@ -122,14 +117,6 @@ static void mp_msg_do_init(void){
for(i=0;i<MSGT_MAX;i++) mp_msg_levels[i] = -2;
mp_msg_cancolor = isatty(fileno(stdout));
mp_msg_levels[MSGT_IDENTIFY] = -1; // no -identify output by default
-#ifdef CONFIG_GETTEXT
- textdomain("mpv");
- char *localedir = getenv("MPV_LOCALEDIR");
- if (localedir == NULL && strlen(MPLAYER_LOCALEDIR))
- localedir = MPLAYER_LOCALEDIR;
- bindtextdomain("mpv", localedir);
- bind_textdomain_codeset("mpv", "UTF-8");
-#endif
}
int mp_msg_test(int mod, int lev)
@@ -269,67 +256,6 @@ void mp_msg(int mod, int lev, const char *format, ...)
va_end(va);
}
-char *mp_gtext(const char *string)
-{
-#ifdef CONFIG_GETTEXT
- /* gettext expects the global locale to be set with
- * setlocale(LC_ALL, ""). However doing that would suck for a
- * couple of reasons (locale stuff is badly designed and sucks in
- * general).
- *
- * First, setting the locale, especially LC_CTYPE, changes the
- * behavior of various C functions and we don't want that - we
- * want isalpha() for example to always behave like in the C
- * locale.
-
- * Second, there is no way to enforce a sane character set. All
- * strings inside MPlayer must always be in utf-8, not in the
- * character set specified by the system locale which could be
- * something different and completely insane. The locale system
- * lacks any way to say "set LC_CTYPE to utf-8, ignoring the
- * default system locale if it specifies something different". We
- * could try to work around that flaw by leaving LC_CTYPE to the C
- * locale and only setting LC_MESSAGES (which is the variable that
- * must be set to tell gettext which language to translate
- * to). However if we leave LC_MESSAGES set then things like
- * strerror() may produce completely garbled output when they try
- * to translate their results but then try to convert some
- * translated non-ASCII text to the character set specified by
- * LC_CTYPE which would still be in the C locale (this doesn't
- * affect gettext itself because it supports specifying the
- * character set directly with bind_textdomain_codeset()).
- *
- * So the only solution (at least short of trying to work around
- * things possibly producing non-utf-8 output) is to leave all the
- * locale variables unset. Note that this means it's not possible
- * to get translated output from any libraries we call if they
- * only rely on the broken locale system to specify the language
- * to use; this is the case with libc for example.
- *
- * The locale changing below is rather ugly, but hard to avoid.
- * gettext doesn't support specifying the translation target
- * directly, only through locale.
- * The main actual problem this could cause is interference with
- * other threads; that could be avoided with thread-specific
- * locale changes, but such functionality is less standard and I
- * think it's not worth adding pre-emptively unless someone sees
- * an actual problem case.
- */
- setlocale(LC_MESSAGES, "");
- string = gettext(string);
- setlocale(LC_MESSAGES, "C");
-#endif
- return (char *)string;
-}
-
-void mp_tmsg(int mod, int lev, const char *format, ...)
-{
- va_list va;
- va_start(va, format);
- mp_msg_va(mod, lev, mp_gtext(format), va);
- va_end(va);
-}
-
// legacy names
static const char *module_text[MSGT_MAX] = {
"global",
@@ -461,11 +387,3 @@ void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
mp_msg_log_va(log, lev, format, va);
va_end(va);
}
-
-void mp_tmsg_log(struct mp_log *log, int lev, const char *format, ...)
-{
- va_list va;
- va_start(va, format);
- mp_msg_log_va(log, lev, mp_gtext(format), va);
- va_end(va);
-}
diff --git a/mpvcore/mp_msg.h b/mpvcore/mp_msg.h
index 7868d9c89d..4c5b6eabfb 100644
--- a/mpvcore/mp_msg.h
+++ b/mpvcore/mp_msg.h
@@ -137,12 +137,12 @@ bool mp_msg_test_log(struct mp_log *log, int lev);
#include "config.h"
#include "mpvcore/mp_common.h"
-char *mp_gtext(const char *string);
+#define mp_gtext(x) ((char*)(x))
// Note: using mp_msg_log or the MP_ERR/... macros is preferred.
void mp_msg_va(int mod, int lev, const char *format, va_list va);
void mp_msg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4);
-void mp_tmsg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4);
+#define mp_tmsg mp_msg
#define mp_dbg mp_msg
struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
@@ -150,8 +150,6 @@ struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
void mp_msg_log(struct mp_log *log, int lev, const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
-void mp_tmsg_log(struct mp_log *log, int lev, const char *format, ...)
- PRINTF_ATTRIBUTE(3, 4);
// Convenience macros, typically called with a pointer to a context struct
// as first argument, which has a "struct mp_log log;" member.