git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Nate Weaver <wevah@derailer.org>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: primenico@gmail.com, "Git List" <git@vger.kernel.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [Bug report] Git incorrectly selects language in macos
Date: Tue, 15 Jan 2019 13:06:17 -0600	[thread overview]
Message-ID: <355CD611-C58E-43E1-838C-017CAEF5AD38@derailer.org> (raw)
In-Reply-To: <89DD4C7B-7F8B-42C5-81F2-F14D5B2D4CFD@derailer.org>


--Nate Weaver (Wevah)

> On Jan 15, 2019, at 10:43:48, Nate Weaver <wevah@derailer.org> wrote:
> 
>> On Jan 15, 2019, at 09:35:52, Nate Weaver <wevah@derailer.org> wrote:
>> 
>>> On Sep 16, 2018, at 02:15:33, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> 
>>> On Fri, Sep 14, 2018 at 10:20 PM Niko Dzhus <primenico@gmail.com> 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.
>>>> 
>>>> Anybody here familiar enough with the build process and dependencies
>>>> of git to pinpoint what exactly is causing this and how to fix it?...
>>> 
>>> This problem is not specific to Git. Earlier in the thread, Ævar
>>> asked[1] if the problem also occurs with other command-line programs,
>>> and indeed it does. For instance, I tried with 'wget' installed via
>>> brew, and it exhibits the same odd behavior. Ævar suggested that there
>>> might be some magic special-casing English, which makes me wonder if
>>> brew builds such magic into gettext(?) or if the magic is part of
>>> MacOS itself.
>>> 
>>> [1]: https://public-inbox.org/git/87a7ojlp31.fsf@evledraar.gmail.com/
>> 
>> I discovered that moving/renaming /usr/local/share/locale made this
>> issue go away for me. While 'de' and 'fr' have a git.mo file in their
>> LC_MESSAGES subdirectory, there is no 'en' directory.
>> 
>> If I copy the 'fr' version to a newly-created 'en' directory, then all my
>> git output is in French; my language order in System Preferences is
>> English (US) -> German -> Japanese.
>> 
>> Not sure if this is gettext's or macOS's issue.
>> 
>> --Nate Weaver (Wevah)
> 
> 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.

Nevermind: I've been informed that this has already been fixed on the git trunk
for gettext, and will be in the next release.

(See: https://savannah.gnu.org/bugs/?49560)


  reply	other threads:[~2019-01-15 19:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 19:08 [Bug report] Git incorrectly selects language in macos Niko Dzhus
2018-09-14 21:57 ` Ævar Arnfjörð Bjarmason
2018-09-15  0:51   ` Niko Dzhus
2018-09-15  2:20 ` Niko Dzhus
2018-09-16  7:15   ` Eric Sunshine
2019-01-15 15:35     ` Nate Weaver
2019-01-15 16:43       ` Nate Weaver
2019-01-15 19:06         ` Nate Weaver [this message]
2019-01-15 20:36           ` Eric Sunshine
2019-01-16  2:16         ` Jonathan Nieder
2019-01-16  2:28         ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=355CD611-C58E-43E1-838C-017CAEF5AD38@derailer.org \
    --to=wevah@derailer.org \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=primenico@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).