Re: Has anyone looked at Gettext support for Git itself?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 16, 2010 at 00:03, Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> 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?
>>
>> I'd be interested in submitting patches to make the existing strings
>> translatable if someone could get the tool + build skeleton going.
>
> First, git uses multiple programming languages: you would need a
> solution that would work for programs in C (gettext), for Perl
> (Locale::Maketext or less known Data::Localize), probably for Python,
> and what would probably give most problems for shell scripts.

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.

For e.g. shellscripts this can be done as (adapted from a localized
script in my /usr/bin/):

    export TEXTDOMAIN=git-bisect
    export TEXTDOMAINDIR=/usr/share/locale/
    GETTEXT=`which gettext 2> /dev/null`
    if [ -z $GETTEXT ] ; then GETTEXT='echo -n'; fi

And then just:

    - echo "We are not bisecting."
    + $GETTEXT "We are not bisecting."

> Second, you would need to take care that changing locale wouldn't
> break git.  It can be done either via setting LC_ALL=C in
> git-sh-setup, or by translation only porcelain, and leaving plumbing
> unchanged.

I think it would be fine to break it if that means that Git would
suddenly start speaking your language, you can always just set LC_ALL
if you have some scripts that break as a result of parsing the current
output in English.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]