From: Jonathan Nieder Date: Wed, 16 Jan 2019 02:16:58 GMT Subject: Re: [Bug report] Git incorrectly selects language in macos Message-ID: <20190116021658.GB8864@google.com> In-Reply-To: <89DD4C7B-7F8B-42C5-81F2-F14D5B2D4CFD@derailer.org> Nate Weaver wrote: >>> On Fri, Sep 14, 2018 at 10:20 PM Niko Dzhus wrote: >>>> Looks like the issue appeared after updating git from brew. [...] >>>> A quick search revealed that brew changed how it builds git recently. >>>> I think, it just didn't include i18n by default before, so I never >>>> noticed this. [...] > Upon further digging, this is an issue in gettext's code on macOS: > The function _nl_language_preferences_default (in langprefs.c) specifically > breaks early when it sees the literal string "en" in the list (from the > "AppleLanguages" defaults key), but not when it gets "en-US", etc. > > I.e., it doesn't check for a prefix. > > This can be fixed (though there might be a better way) simply by replacing > both instances of > > if (strcmp (buf, "en") == 0) > > with > > if (strncmp (buf, "en", 2) == 0) > > in gettext's langprefs.c. Nice sleuthing. Do you have a bug tracking this in homebrew's issue tracker, either for the git formula or the gettext formula? Thanks, Jonathan