git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 18, 2010, 10:57 UTC
Message-ID
<AANLkTikK9LAd_pwTwB56Vpq19i00X5apy6qT-ZOpnLEp@mail.gmail.com>
In-Reply-To
<20100517160208.GA20842@unpythonic.net>
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.

Next: Jeff Epler
Message 1 of 3 in “Re: [PATCH] WIP: begin to translate git with gettext”
  1. Ævar Arnfjörð BjarmasonMay 18, 2010
  2. Jeff EplerMay 18, 2010
  3. Ævar Arnfjörð BjarmasonMay 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.