git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jan Hudec <bulb@ucw.cz>
Cc: Jakub Narebski <jnareb@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Has anyone looked at Gettext support for Git itself?
Date: Sun, 16 May 2010 17:37:34 +0000	[thread overview]
Message-ID: <AANLkTinGSBRMRyaD0w2p9PQELLA6ThvKFdi6hcNWBTxr@mail.gmail.com> (raw)
In-Reply-To: <20100516160800.GB22447@efreet.light.src>

On Sun, May 16, 2010 at 16:08, Jan Hudec <bulb@ucw.cz> wrote:
> On Sun, May 16, 2010 at 01:12:20 +0000, Ævar Arnfjörð Bjarmason wrote:
>> On Sun, May 16, 2010 at 00:03, Jakub Narebski <jnareb@gmail.com> wrote:
>> > Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> >
>> >> I couldn't find anything about this in the list archives. Have there
>> >> been any discussions of adding internationalization support to Git
>> >> itself? I.e. the interface messages that the core Git utilities emit.
>> >>
>> >> I tried to get started with integrating GNU Gettext, but gnuish
>> >> assumptions it makes about building make it a bit hard.
>> >>
>> >> Is there perhaps another gettext implementation that would be more
>> >> suitable for Git?
>
> Gettext iself does not make any assumptions about building. It's only it's
> manual that gives more space to setting up gettext use with autotools than
> manually. But doing it manually is really not too hard.
>
> Basically one just needs to set up scripts or makefile targets to:
>  - Re-generate the translation template (.pot)
>   All this takes is invoking xgettext with correct parameters on the right
>   list of files. It might be necessary to invoke it with different arguments
>   for sources in different languages if git needed to use non-default
>   options, but I think the defaults would be ok.
>  - Update the translations with new strings from the template.
>   All this takes is invoking msgmerge for each .po file with the appropriate
>   template.
>
> Than makefile targets are needed to generate and install the .mc files, but
> that's just trivial.
>
> I don't think the automake support saves any work there. It saves you from
> learning the tool invocations, but you have to learn automake instead.
> The hardest part is makring all the translatable strings in the code and
> the gnuish infrastructure just isn't much help there anyway.

Right, someone has to come up with all the makefile / build magic one
way or another.

I'm just really not familiar with that side of things, which was why I
asked if someone had tried it already.

Is someone on-list familiar with a non-GNU program that does all its
gettext support manually, i.e. not with the gnu autotools?

I'm not, examples would help :)

>> All of these languages can read gettext, but you'd need some glue for
>> each so that they could get to the files.
>>
>> It would probably make the most sense to have distinct message files
>> for each program, e.g.:
>>
>>     /usr/share/locale/*/LC_MESSAGES/git-bisect.mo
>>
>> That way they could be translated incrementally, and the programs
>> would load only the small subset of messages they need.
>
> I think it would make things more complicated and not really help anything,
> since many messages may in fact be shared or come from common parts so it
> would need to be loaded by many commands anyway. On the other hand the .mc
> file is an external hash, so the access even to a large .mc will be quite
> fast.

Right, squashing them all into one .mo file may be the best thing,
particularly, as you mention, for the case of displaying messages from
more than one tool.

That might mean message collisions, but that can be solved these days
with gettext's msgctxt.

> It would definitely not be fine to break *git*. You need to make sure no
> part of git itself or anything distributed with it (gitk, git gui, gitweb,
> things in contrib) is looking for any string that might be broken by
> translating.

Of course internal breakage, i.e. git-foo parsing the output from
git-bar breaking under non-English is unacceptable. I meant that
external tools now running under some non-English locale may start
breaking if they're parsing the output and assuming English. The
remedy for that is easy though, just prefix the calls to git with
LC_ALL=C.

  reply	other threads:[~2010-05-16 17:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-15 22:10 Has anyone looked at Gettext support for Git itself? Ævar Arnfjörð Bjarmason
2010-05-16  0:03 ` Jakub Narebski
2010-05-16  1:12   ` Ævar Arnfjörð Bjarmason
2010-05-16  5:36     ` Dmitry Potapov
2010-05-16 13:12       ` Ævar Arnfjörð Bjarmason
2010-05-16 16:08     ` Jan Hudec
2010-05-16 17:37       ` Ævar Arnfjörð Bjarmason [this message]
2010-05-17 14:32         ` Thomas Rast
2010-05-17 14:53           ` Ævar Arnfjörð Bjarmason
2010-05-17 15:12             ` Thomas Rast
2010-05-17 17:59               ` Jan Hudec
2010-05-17 18:56                 ` Will Palmer
2010-05-18  7:51                   ` Michael J Gruber
2010-05-18  9:35                     ` Thomas Singer
2010-05-18 13:33                       ` Will Palmer
2010-05-22 11:01                         ` Jan Hudec
2010-05-19 15:43             ` demerphq
2010-05-16 16:53 ` Thomas Singer
2010-05-17 15:04 ` Marc Weber
2010-05-18  7:12 ` Peter Krefting

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=AANLkTinGSBRMRyaD0w2p9PQELLA6ThvKFdi6hcNWBTxr@mail.gmail.com \
    --to=avarab@gmail.com \
    --cc=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.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).