Can we require gettext-0.15 for Windows?

1,685 views
Skip to first unread message

Malcolm Tredinnick

unread,
Mar 18, 2009, 5:58:28 AM3/18/09
to Django I18N
Since I haven't used Windows seriously in over 10 years, I need some
help here...

How difficult or easy is it to find a binary for gettext 0.15 (or later)
for Windows systems?

My reason for asking is that I would like to use a feature that was only
introduced in that version to provide context for messages where the
same string appears in two different places and should be translated
differently. There's an option to add msgctx alongside msgid and this
will provide translators with some help.

One obvious place where this appears is where we have "May" as a three
character abbreviation as well as "May" as the full month name. In some
languages, those two will be different translations, so we can mark them
differently. There are other instances reported as well.

I'm not 100% sure if we can use this yet, since it's not supported by
Python's gettext modules, so I need to fake out the gettext layer, but I
think it's possible. Would be good to know if it's worth putting in the
effort.

Regards,
Malcolm

Ramiro Morales

unread,
Mar 18, 2009, 6:46:27 AM3/18/09
to Djang...@googlegroups.com
On Wed, Mar 18, 2009 at 6:58 AM, Malcolm Tredinnick
<mal...@pointy-stick.com> wrote:
>
> [...]

>
> How difficult or easy is it to find a binary for gettext 0.15 (or later)
> for Windows systems?

Unfortunately it has proven to be very difficult, searches I've done
in the past have always ended with a handful of rather old
binaries (some of them even buggy as the note added to i18n.txt
r9155 shows). One thing I've meaning to to for ages is to set up all
the cygwin + msys stuff necesary to be able to create a set
of gettext 0.17 win32 binaries.

What would be the time frame you envision for this? Maybe
I can try to work on this.

>
> My reason for asking is that I would like to use a feature that was only
> introduced in that version to provide context for messages where the
> same string appears in two different places and should be translated
> differently.
>

> [...]


>
> I'm not 100% sure if we can use this yet, since it's not supported by
> Python's gettext modules, so I need to fake out the gettext layer, but I
> think it's possible. Would be good to know if it's worth putting in the
> effort.

Python bug 2504 is tracking this:

http://bugs.python.org/issue2504

--
Ramiro Morales
http://rmorales.net

Malcolm Tredinnick

unread,
Mar 18, 2009, 8:11:37 PM3/18/09
to Djang...@googlegroups.com
On Wed, 2009-03-18 at 07:46 -0300, Ramiro Morales wrote:
> On Wed, Mar 18, 2009 at 6:58 AM, Malcolm Tredinnick
> <mal...@pointy-stick.com> wrote:
> >
> > [...]
> >
> > How difficult or easy is it to find a binary for gettext 0.15 (or later)
> > for Windows systems?
>
> Unfortunately it has proven to be very difficult, searches I've done
> in the past have always ended with a handful of rather old
> binaries (some of them even buggy as the note added to i18n.txt
> r9155 shows). One thing I've meaning to to for ages is to set up all
> the cygwin + msys stuff necesary to be able to create a set
> of gettext 0.17 win32 binaries.
>
> What would be the time frame you envision for this? Maybe
> I can try to work on this.

If your answer had been "it's easy right now to download them", I would
make this change right now so we can fix the problems in 1.1. Given that
it's not at all easy, we'll need to be a bit more gentle with the
translators in general. So I think trying to get this done in the 1.2
timeframe, making the switch to using contexts in the few places we need
them before 1.2-alpha, would be reasonable. We have enough to do in the
next month for 1.1 without adding this to the plate.


>
> >
> > My reason for asking is that I would like to use a feature that was only
> > introduced in that version to provide context for messages where the
> > same string appears in two different places and should be translated
> > differently.
> >
> > [...]
> >
> > I'm not 100% sure if we can use this yet, since it's not supported by
> > Python's gettext modules, so I need to fake out the gettext layer, but I
> > think it's possible. Would be good to know if it's worth putting in the
> > effort.
>
> Python bug 2504 is tracking this:
>
> http://bugs.python.org/issue2504

Yeah, I'd seen that. I was going to introduce something similar into
Django's translation utilities (also in pure Python). I think this is
achievable.

Thanks for the answer here. It helps flesh out my cunning plan a bit
more. Let's put this on the list for 1.2, then.

Regards,
Malcolm

Marc Fargas

unread,
Mar 19, 2009, 1:24:50 PM3/19/09
to Djang...@googlegroups.com
On Wed, Mar 18, 2009 at 10:58 AM, Malcolm Tredinnick <mal...@pointy-stick.com> wrote:

How difficult or easy is it to find a binary for gettext 0.15 (or later)
for Windows systems?

I do not know what can be considered a "binary for gettext" but in the GNOME FTP you can find some stuff ( http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ ) mainly http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip  which has a "intl.dll" file. Not sure if it's enough ;)

I read somewhere (Readme of the same zip file, version 0.15 available in GNU servers) that you need libiconv to use gettext also, it's on the same folder.

Hope it helps in someway ;)
Marc

Ramiro Morales

unread,
Mar 19, 2009, 3:06:19 PM3/19/09
to Djang...@googlegroups.com
On Thu, Mar 19, 2009 at 2:24 PM, Marc Fargas <tele...@telenieko.com> wrote:
>
> I do not know what can be considered a "binary for gettext" but in the GNOME
> FTP you can find some stuff (
> http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ ) mainly
> http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip
> which has a "intl.dll" file. Not sure if it's enough ;)
>
> I read somewhere (Readme of the same zip file, version 0.15 available in GNU
> servers) that you need libiconv to use gettext also, it's on the same
> folder.

Hrm unfortunately no, GNU FTP servers have, besides the latest source
distributions, win32 binaries of gettext 0.13.1:

http://ftp.gnu.org/pub/gnu/gettext/

Fortunately this doesn't matter anymore because of what you've found,
see below.

>
> Hope it helps in someway ;)

Sure it does. Thanks Marc! I've tested them in the following way:

Downloaded:

http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-tools-0.17.zip
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip

and unpacked the contents of their bin/ directories to a directory
listed in my PATH environment variable.

(Just in case I also put there the GNU.Gettext.dll and charset.alias
files from the lib/ directory contained in gettext-tools-0.17.zip)

Now I can run::

C:\>xgettext --version
xgettext (GNU gettext-tools) 0.17
Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.

And the same for msgmerge, msguniq and msgfmt.

All of

python django-admin.py makemessages -l es_AR

python django-admin.py makemessages -l es_AR -d djangojs

python django-admin.py makemessages -a

python django-admin.py makemessages -a -d djangojs

python django-admin.py compilemessages -l es_AR

python django-admin.py compilemessages

run without problems, and comparing the generated .mo files with the
ones contained in the Django SVN repository shows they only differ
in the timestamp contained in the msgid "" header.

So it seems everything is working correctly. This means we can at least
rewrite the

http://docs.djangoproject.com/en/dev/topics/i18n/#gettext-on-windows

documentation section.

Thanks again!.

--
Ramiro Morales
http://rmorales.net

PS: Googling for gettext-tools-0.17.zip I see now the GNOME FTP server appears
third in the result list :(
PS2: Now I remember a survey related to this I had attempted without success in
the mailing list two years ago:
http://groups.google.com/group/Django-I18N/browse_frm/thread/bf8ba9a92dd0048a

Malcolm Tredinnick

unread,
Mar 19, 2009, 5:47:26 PM3/19/09
to Djang...@googlegroups.com
On Thu, 2009-03-19 at 16:06 -0300, Ramiro Morales wrote:
[...]

> Sure it does. Thanks Marc! I've tested them in the following way:
>
> Downloaded:
>
> http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-tools-0.17.zip
> http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-0.17-1.zip
>
> and unpacked the contents of their bin/ directories to a directory
> listed in my PATH environment variable.
>
> (Just in case I also put there the GNU.Gettext.dll and charset.alias
> files from the lib/ directory contained in gettext-tools-0.17.zip)
>
> Now I can run::
>
[... lots of success snipped ...]

> So it seems everything is working correctly.

Wow. Nice research Marc and thanks for testing Ramiro. I'll have a think
about whether we want to push the requirements up for 1.1 in order to
support contexts, or wait for 1.2 (in which case I'd probably make the
change as soon as 1.1.x is made into a branch and 1.2-pre is trunk).

I must admit I don't really have a good intuition as to how many people
are using Windows for translation. This list isn't a good measure as we
get a lot of contributions from people I believe aren't on this list.
However, the process does seem fairly straightforward.

Thanks, guuys.

Regards,
Malcolm


Reply all
Reply to author
Forward
0 new messages