diff --git a/configure.ac b/configure.ac index 8f1b95fad..620bd3ad8 100644 --- a/configure.ac +++ b/configure.ac @@ -305,7 +305,7 @@ AC_CHECK_FUNCS( futimens clock_gettime ) AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] ) if test x$local_gettext != xno; then - AC_CHECK_FUNCS( gettext dcgettext ) + AC_CHECK_FUNCS( gettext ) # # The Makefile also needs to know if we have gettext, so it knows if diff --git a/src/env.cpp b/src/env.cpp index 84baa76f8..c7924aeff 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -9,7 +9,9 @@ #include #include #include +#ifdef HAVE__NL_MSG_CAT_CNTR #include +#endif #include #include #include @@ -191,15 +193,13 @@ static void handle_locale(const wchar_t *env_var_name) { const char *new_msg_locale = setlocale(LC_MESSAGES, NULL); debug(3, L"old LC_MESSAGES locale: '%s'", old_msg_locale); debug(3, L"new LC_MESSAGES locale: '%s'", new_msg_locale); +#ifdef HAVE__NL_MSG_CAT_CNTR if (strcmp(old_msg_locale, new_msg_locale)) { - // Try to make change known to gettext. Both changing _nl_msg_cat_cntr and calling dcgettext - // might potentially tell some gettext implementation that the translation strings should be - // reloaded. We do both and hope for the best. - debug(2, L"changing message locale from '%s' to '%s'", old_msg_locale, new_msg_locale); + // Make change known to GNU gettext. extern int _nl_msg_cat_cntr; _nl_msg_cat_cntr++; - fish_dcgettext("fish", "Changing language to English", LC_MESSAGES); } +#endif } /// Check if the specified variable is a locale variable. diff --git a/src/fallback.cpp b/src/fallback.cpp index 9b7468425..c3ef3462f 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -171,7 +171,6 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) { #endif #ifndef HAVE_WCSLCPY - /*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/ /* @@ -189,7 +188,6 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) { * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) { register wchar_t *d = dst; register const wchar_t *s = src; @@ -212,11 +210,9 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) { return s - src - 1; // Count does not include NUL. } - #endif #ifndef HAVE_LRAND48_R - int lrand48_r(struct drand48_data *buffer, long int *result) { *result = rand_r(&buffer->seed); return 0; @@ -226,20 +222,16 @@ int srand48_r(long int seedval, struct drand48_data *buffer) { buffer->seed = (unsigned int)seedval; return 0; } - #endif #ifndef HAVE_FUTIMES - int futimes(int fd, const struct timeval *times) { errno = ENOSYS; return -1; } - #endif #if HAVE_GETTEXT - char *fish_gettext(const char *msgid) { return gettext(msgid); ; @@ -250,35 +242,10 @@ char *fish_bindtextdomain(const char *domainname, const char *dirname) { } char *fish_textdomain(const char *domainname) { return textdomain(domainname); } - #else - char *fish_gettext(const char *msgid) { return (char *)msgid; } - char *fish_bindtextdomain(const char *domainname, const char *dirname) { return NULL; } - char *fish_textdomain(const char *domainname) { return NULL; } - -#endif - -#if HAVE_DCGETTEXT - -char *fish_dcgettext(const char *domainname, const char *msgid, int category) { - return dcgettext(domainname, msgid, category); -} - -#else - -char *fish_dcgettext(const char *domainname, const char *msgid, int category) { - return (char *)msgid; -} - -#endif - -#ifndef HAVE__NL_MSG_CAT_CNTR - -int _nl_msg_cat_cntr = 0; - #endif #ifndef HAVE_KILLPG @@ -299,18 +266,12 @@ double nan(char *tagp) { return 0.0 / 0.0; } #endif #if !HAVE_BROKEN_WCWIDTH - int fish_wcwidth(wchar_t wc) { return wcwidth(wc); } - int fish_wcswidth(const wchar_t *str, size_t n) { return wcswidth(str, n); } - #else - static int mk_wcwidth(wchar_t wc); static int mk_wcswidth(const wchar_t *pwcs, size_t n); - int fish_wcwidth(wchar_t wc) { return mk_wcwidth(wc); } - int fish_wcswidth(const wchar_t *str, size_t n) { return mk_wcswidth(str, n); } /* @@ -373,7 +334,6 @@ int fish_wcswidth(const wchar_t *str, size_t n) { return mk_wcswidth(str, n); } * * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ - struct interval { int first; int last; @@ -502,5 +462,4 @@ static int mk_wcswidth(const wchar_t *pwcs, size_t n) { } return width; } - #endif // HAVE_BROKEN_WCWIDTH diff --git a/src/fallback.h b/src/fallback.h index 09e301429..7a609b8dd 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -120,15 +120,6 @@ char *fish_bindtextdomain(const char *domainname, const char *dirname); /// Cover for textdomain(). char *fish_textdomain(const char *domainname); -/// Cover for dcgettext. -char *fish_dcgettext(const char *domainname, const char *msgid, int category); - -#ifndef HAVE__NL_MSG_CAT_CNTR -/// Some gettext implementation use have this variable, and by increasing it, one can tell the -/// system that the translations need to be reloaded. -extern int _nl_msg_cat_cntr; -#endif - #ifndef HAVE_KILLPG /// Send specified signal to specified process group. int killpg(int pgr, int sig);