diff --git a/common-main.c b/common-main.c index 6a689007e7..51a946f2d9 100644 --- a/common-main.c +++ b/common-main.c @@ -32,12 +32,12 @@ int main(int argc, const char **argv) */ sanitize_stdfds(); + git_extract_argv0_path(argv[0]); + git_setup_gettext(); attr_start(); - git_extract_argv0_path(argv[0]); - restore_sigpipe_to_default(); return cmd_main(argc, argv); diff --git a/gettext.c b/gettext.c index db727ea020..4dab914902 100644 --- a/gettext.c +++ b/gettext.c @@ -6,6 +6,8 @@ #include "gettext.h" #include "strbuf.h" #include "utf8.h" +#include "cache.h" +#include "exec_cmd.h" #ifndef NO_GETTEXT # include @@ -158,14 +160,20 @@ static void init_gettext_charset(const char *domain) void git_setup_gettext(void) { const char *podir = getenv("GIT_TEXTDOMAINDIR"); + char *p = NULL; if (!podir) podir = GIT_LOCALE_PATH; + if (!is_absolute_path(podir)) + podir = p = system_path(podir); + bindtextdomain("git", podir); setlocale(LC_MESSAGES, ""); setlocale(LC_TIME, ""); init_gettext_charset("git"); textdomain("git"); + + free(p); } /* return the number of columns of string 's' in current locale */