forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgettext.c
More file actions
35 lines (32 loc) · 754 Bytes
/
gettext.c
File metadata and controls
35 lines (32 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "exec_cmd.h"
#include <locale.h>
#include <libintl.h>
#ifdef HAVE_LIBCHARSET_H
#include <libcharset.h>
#else
#include <langinfo.h>
#endif
#include <stdlib.h>
extern void git_setup_gettext(void) {
char *podir;
char *envdir = getenv("GIT_TEXTDOMAINDIR");
const char *charset;
if (envdir) {
(void)bindtextdomain("git", envdir);
} else {
podir = (char *)system_path("share/locale");
if (!podir) return;
(void)bindtextdomain("git", podir);
free(podir);
}
(void)setlocale(LC_MESSAGES, "");
(void)setlocale(LC_CTYPE, "");
#ifdef HAVE_LIBCHARSET_H
charset = locale_charset();
#else
charset = nl_langinfo(CODESET);
#endif
(void)bind_textdomain_codeset("git", charset);
(void)setlocale(LC_CTYPE, "C");
(void)textdomain("git");
}