Re: [PATCH] WIP: begin to translate git with gettext
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:48:49
On Mon, May 17, 2010 at 16:02, Jeff Epler [off-list ref] wrote:
Signed-off-by: Jeff Epler <redacted> --- 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.