summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--audio/out/ao.c2
-rwxr-xr-xconfigure24
-rw-r--r--mpvcore/mp_msg.c82
-rw-r--r--mpvcore/mp_msg.h6
-rw-r--r--video/out/vo.c2
5 files changed, 4 insertions, 112 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index 566ab0fea9..416bec43f0 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -130,7 +130,7 @@ static struct ao *ao_create(bool probing, struct mpv_global *global,
struct mp_log *log = mp_log_new(NULL, global->log, "ao");
struct m_obj_desc desc;
if (!m_obj_list_find(&desc, &ao_obj_list, bstr0(name))) {
- mp_tmsg_log(log, MSGL_ERR, "Audio output %s not found!\n", name);
+ mp_msg_log(log, MSGL_ERR, "Audio output %s not found!\n", name);
talloc_free(log);
return NULL;
};
diff --git a/configure b/configure
index 2c41e05a34..a0c6a84532 100755
--- a/configure
+++ b/configure
@@ -289,7 +289,6 @@ Installation directories:
--docdir=DIR directory for installing docs [PREFIX/share/doc/mpv]
--confdir=DIR directory for installing configuration files
[PREFIX/etc/mpv]
- --localedir=DIR directory for gettext locales [PREFIX/share/locale]
Optional features:
--disable-encoding disable encoding functionality [enable]
@@ -374,9 +373,6 @@ Audio output:
--disable-wasapi disable WASAPI (event mode) audio output [autodetect]
--disable-select disable using select() on the audio device [enable]
-Localization options:
- --enable-gettext enable gettext() usage [disable]
-
Miscellaneous options:
--enable-cross-compile enable cross-compilation [disable]
--cc=COMPILER C compiler to build mpv [gcc]
@@ -480,7 +476,6 @@ _terminfo=auto
_termcap=auto
_termios=auto
_shm=auto
-_gettext=no
_cdda=auto
_coreaudio=auto
_corevideo=auto
@@ -523,9 +518,6 @@ for ac_option do
--confdir=*)
_confdir=$(echo $ac_option | cut -d '=' -f 2)
;;
- --localedir=*)
- _localedir=$(echo $ac_option | cut -d '=' -f 2)
- ;;
--with-install=*)
_install=$(echo $ac_option | cut -d '=' -f 2 )
@@ -581,8 +573,6 @@ for ac_option do
--disable-optimization)
_opt=
;;
- --enable-gettext) _gettext=yes ;;
- --disable-gettext) _gettext=no ;;
--enable-cross-compile) _cross_compile=yes ;;
--disable-cross-compile) _cross_compile=no ;;
--enable-encoding) _encoding=yes ;;
@@ -753,7 +743,6 @@ test -z "$_bindir" && _bindir="$_prefix/bin"
test -z "$_mandir" && _mandir="$_prefix/share/man"
test -z "$_docdir" && _docdir="$_prefix/share/doc/mpv"
test -z "$_confdir" && _confdir="$_prefix/etc/mpv"
-test -z "$_localedir" && _localedir="$_prefix/share/locale"
for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
test "$tmpdir" && break
@@ -1260,15 +1249,6 @@ else
fi
-echocheck "gettext support"
-if test "$_gettext" = yes; then
- def_gettext="#define CONFIG_GETTEXT 1"
-else
- def_gettext="#undef CONFIG_GETTEXT"
-fi
-echores "$_gettext"
-
-
echocheck "nanosleep"
_nanosleep=no
statement_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
@@ -3228,7 +3208,6 @@ BINDIR = \$(DESTDIR)$_bindir
MANDIR = \$(DESTDIR)$_mandir
DOCDIR = \$(DESTDIR)$_docdir
CONFDIR = \$(DESTDIR)$_confdir
-LOCALEDIR = \$(DESTDIR)$_localedir
CC = $_cc
CXX = $_cc
@@ -3358,9 +3337,6 @@ cat > $TMPH << EOF
#define CONFIGURATION "$configuration"
#define MPLAYER_CONFDIR "$_confdir"
-#define MPLAYER_LOCALEDIR "$_localedir"
-
-$def_gettext
/* system headers */
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.
diff --git a/video/out/vo.c b/video/out/vo.c
index 6892ee5bf6..65f3f680b4 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -151,7 +151,7 @@ static struct vo *vo_create(struct mpv_global *global,
struct mp_log *log = mp_log_new(NULL, global->log, "vo");
struct m_obj_desc desc;
if (!m_obj_list_find(&desc, &vo_obj_list, bstr0(name))) {
- mp_tmsg_log(log, MSGL_ERR, "Video output %s not found!\n", name);
+ mp_msg_log(log, MSGL_ERR, "Video output %s not found!\n", name);
talloc_free(log);
return NULL;
};