Django i18n design rationale

29 views
Skip to first unread message

Jure Erznožnik

unread,
Jan 1, 2016, 6:31:54 PM1/1/16
to Django users
I've worked with Django for the past few months. While this - I realize - is not much, so far it has been an extremely pleasant experience. Everything seems to be designed just right and works really nicely out of the box.

So I was that much more surprised when I had to prepare my first app for localization. It's not like anything didn't work - it did - it just didn't FEEL right to me. So in light of everythin else being just right, I'd like to ask the community to set me straight on a few points that I'm having issues with:

1. Expressions gathering vs declaring: Django has utilities to gather expressions from sources, txt files and also javascript files. While that by itself is a design choice, it also presents us with problems such as (possibly very) long expression keys, random .po file layout, etc. Are there any serious advantages that favor this approach vs declarative one?

2. What's the point of .po / .mo files? Their structure is not really far from standard Python code, so why all the work with compilation?

3. Why (except for reducing expression count) does javascript code have to be gathered in a special domain? Shouldn't that be up to me to decide whether to stick all expressions into one big file or split them up?

LP,
Jure

Raphael Michel

unread,
Jan 2, 2016, 12:13:52 PM1/2/16
to Jure Erznožnik, Django users
Hi,

Am Fri, 1 Jan 2016 15:29:16 -0800 (PST)
schrieb Jure Erznožnik <jure.er...@gmail.com>:
> 1. Expressions gathering vs declaring: Django has utilities to gather
> expressions from sources, txt files and also javascript files. While
> that by itself is a design choice, it also presents us with problems
> such as (possibly very) long expression keys, random .po file layout,
> etc. Are there any serious advantages that favor this approach vs
> declarative one?
>
> 2. What's the point of .po / .mo files? Their structure is not really
> far from standard Python code, so why all the work with compilation?

I wasn't around Django at that time, but to mee it seems pretty
clear that those two aren't explicit design decisions made by Django but
instead Django just decided to use gettext[1], the de-facto standard for
internationalization in the Unix world instead of implementing an own
system and both the gathering and the .mo files are old design
decisions of gettext.

Cheers
Raphael

Reply all
Reply to author
Forward
0 new messages