threads / patch / 23836

patchRe: [PATCH] WIP: begin to translate git with gettext

Subject: Re: [PATCH] WIP: begin to translate git with gettext

## tl;dr

3 messages between May 18, 2010 and May 18, 2010. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Ævar Arnfjörð Bjarmason· May 18, 2010, 10:57 UTC · lore
On Mon, May 17, 2010 at 16:02, Jeff Epler <jepler@unpythonic.net> wrote:
Show 31 quoted lines
> Signed-off-by: Jeff Epler <jepler@unpythonic.net>
> ---
> While I'm certain that there are a lot of things to object to in this
> patch, it shows 90% of what is needed to use gettext to translate
> the portions of git written in c, without involving undesired gnu
> infrastructure such as automake.
>
> Makefile adds necessary rules for generating git.pot and for building
> and installing compiled message catalogs (.mo) from text message
> catalogs (.po).  It also adds a gettext support header and source file.
>
> Minimal changes are made to git to use the requested LC_CTYPE and
> LC_MESSAGES, and some messages for 'git status' are marked for
> translation.
>
> When I provided a gibberish translation of a message:
> #: wt-status.c:87
> msgid "# Changed but not updated:"
> msgstr "# Changes not blah blah blah"
>
> running 'git status' used the translation:
> $ git status
> # On branch master
> # Your branch is ahead of 'origin/master' by 1 commit.
> #
> # Changes not blah blah blah
> ...
>
> I ran with 'make install' and prefix set in config.mak.  It didn't seem
> to work when running from the source directory, and it may or may not
> work with runtime prefix.
Thanks a lot for this patch.
I'm having some trouble getting it to work though. I did:
    make pot

That made the po/git.pot file with all the relevant messages. Then I made a po/is.po in poedit which has stuff like:

    #: wt-status.c:598
    msgid "On branch "
    msgstr "A greininni "
    #: wt-status.c:605
    msgid "Not currently on any branch."
    msgstr "Ekki á grænni grein.
I did:
    make prefix=/usr all
    sudo make prefix=/usr install

But any invocation of my new git-status (I uninstalled my system git first) with either LC_ALL, LC_MESSAGES or LC_CTYPE set to is, is_IS or is_IS.UTF-8 doest't yield the desired results:

    $ strings /usr/share/locale/is/LC_MESSAGES/git.mo |grep grein
    nni grein.
    A greininni
it doesn't seem to spot the file:
    $ strace git status 2>&1|grep locale
    open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
    open("/usr/share/locale/locale.alias", O_RDONLY) = 3
    open("/usr/lib/locale/is/LC_MESSAGES", O_RDONLY) = -1 ENOENT (No
such file or directory)
    open("/usr/share/locale-langpack/is/LC_MESSAGES", O_RDONLY) = 3
    open("/usr/share/locale-langpack/is/LC_MESSAGES/SYS_LC_MESSAGES",
O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/lib/locale/is/LC_CTYPE", O_RDONLY) = -1 ENOENT (No such
file or directory)
    open("/usr/share/locale-langpack/is/LC_CTYPE", O_RDONLY) = -1
ENOENT (No such file or directory)
    open("share/locale/",
O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5
    open("share/locale/.gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT
(No such file or directory)
    open("share/locale/is/",
O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 6
    open("share/locale/is/.gitignore", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
    open("share/locale/is/LC_MESSAGES/",
O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 7
    open("share/locale/is/LC_MESSAGES/.gitignore",
O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
And the UI remains untranslated.

I'm probably doing something very silly. I'd appreciate some help if you can spot what it is, if I can get this working I can start submitting some i18n patches.

Jeff Epler· May 18, 2010, 16:07 UTC · re: Ævar Arnfjörð Bjarmason · lore

Is it possible that you don't have is_IS language support? On Ubuntu this comes from a package like language-pack-is-base.

I tried your po entries in a file named po/is.po, and it didn't work. When I installed language-pack-is-base, it did.

$ unset LANGUAGE LC_MESSAGES; export LANG=is_IS.UTF-8 $ /usr/local/jepler/git/bin/git status | head -1 # A greininni master

Comparing the bad strace with the good, and excluding ENOENT opens, it's the presence of the is_IS language pack that is the first difference.

Show changes to diff +4 −0
@@ -1,4 +1,8 @@
 open("/usr/share/locale/locale.alias", O_RDONLY) = 3
+open("/usr/lib/locale/is_IS.utf8/LC_MESSAGES", O_RDONLY) = 3
+open("/usr/lib/locale/is_IS.utf8/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
+open("/usr/lib/locale/is_IS.utf8/LC_CTYPE", O_RDONLY) = 3
 open("share/locale/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 14
 open("share/locale/is/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 15
 open("share/locale/is/LC_MESSAGES/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 16
+open("/usr/local/jepler/git/share/locale/is/LC_MESSAGES/git.mo", O_RDONLY) = 12

Jeff
Ævar Arnfjörð Bjarmason· May 18, 2010, 16:47 UTC · re: Jeff Epler · lore
On Tue, May 18, 2010 at 16:07, Jeff Epler <jepler@unpythonic.net> wrote:
Show 9 quoted lines
> Is it possible that you don't have is_IS language support?  On Ubuntu
> this comes from a package like language-pack-is-base.
>
> I tried your po entries in a file named po/is.po, and it didn't work.
> When I installed language-pack-is-base, it did.
>
> $ unset LANGUAGE LC_MESSAGES; export LANG=is_IS.UTF-8
> $ /usr/local/jepler/git/bin/git status | head -1
> # A greininni master
Yes, my system's settings were broken. Thanks, it works now.

← back to recent threads