MCPcopy Create free account
hub / github.com/git/git / init_gettext_charset

Function init_gettext_charset

gettext.c:82–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82static void init_gettext_charset(const char *domain)
83{
84 charset = locale_charset();
85 bind_textdomain_codeset(domain, charset);
86
87 /*
88 * Work around an old bug fixed in glibc 2.17 (released on
89 * 2012-12-24), at the cost of potentially making translated
90 * messages from external functions like perror() emitted in
91 * the wrong encoding.
92 *
93 * The bug affected e.g. git.git's own 7eb93c89651 ([PATCH]
94 * Simplify git script, 2005-09-07), which is the origin of
95 * the "David_K\345gedal" test string.
96 *
97 * See a much longer comment added to this file in 5e9637c6297
98 * (i18n: add infrastructure for translating Git with gettext,
99 * 2011-11-18) for more details.
100 */
101 if (test_vsnprintf("%.*s", 13, "David_K\345gedal") < 0)
102 setlocale(LC_CTYPE, "C");
103}
104
105int git_gettext_enabled = 0;
106

Callers 1

git_setup_gettextFunction · 0.85

Calls 2

locale_charsetFunction · 0.85
test_vsnprintfFunction · 0.85

Tested by

no test coverage detected