thinkle / gourmet

Gourmet Recipe Manager
GNU General Public License v2.0
337 stars 139 forks source link

Integrate the defaults module better with gettext #701

Open ockham opened 11 years ago

ockham commented 11 years ago

It's somewhat regrettable that our default_*.py files don't really fit into the scope of the gettext framework. By consequence, existing translating tools such as Launchpad Translations (which we're using) don't cover them, making them harder to maintain.

It'd be great if we found a way to integrate them better with gettext. As a starting point, we might use inflect.py which has some useful English grammar capabilities.

thinkle commented 11 years ago

Bernhard,

There's a very good reason the default_X files don't fit -- the list of units and measure and conversions is potentially different for each language/locale, as are standard ingredients. There's no way to handle this with simple string->string conversion.

Tom

On Fri, Mar 1, 2013 at 7:14 AM, Bernhard Reiter notifications@github.comwrote:

It's somewhat regrettable that our default_*.py files don't really fit into the scope of the gettext framework. By consequence, existing translating tools such as Launchpad Translations (which we're using) don't cover them, making them harder to maintain.

It'd be great if we found a way to integrate them better with gettext. As a starting point, we might use inflect.pyhttp://pypi.python.org/pypi/inflectwhich has some useful English grammar capabilities.

— Reply to this email directly or view it on GitHubhttps://github.com/thinkle/gourmet/issues/701 .

ockham commented 11 years ago

I know, and I've given this some thought, too. At least for ingredient lists, I believe we could do something like

SYNONYMS=[
# the first item of each list is the default
_("arugula, rocket"),
_("azuki beans, adzuki beans, adzuki, azuki"),

etc., which then get translated with gettext tools e.g. to

Rucola, Rauke
Azukibohnen, Adzukibohnen, Adzuki, Azuki

and split up into lists of individual synonyms along the commas by the code.

Note that this allows different numbers of synonyms for different languages, too.