Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2368 (closed enhancement: fixed)

Opened 8 years ago

Last modified 7 years ago

[PATCH] Collect translatable strings in explicit gettext function calls in Genshi templates

Reported by: Chris Arndt Owned by: Chris Arndt
Priority: normal Milestone: 1.1.1
Component: I18n Version: 1.1 HEAD
Severity: normal Keywords: i18n, genshi, tg-admin
Cc:

Description

A while ago I committed a patch (r5799) for i18n in TG 1.1 that allowed translatable strings in Genshi templates to be collected with "tg-admin i18n collect".

The current function does not collect any strings within Python expressions, because with the Genshi Translator filter you do not need to wrap your translatable strings in gettext function calls.

This works good so far, since the Translator filter is automatically added in the Genshi renderer by TurboGears. But in the interest of easy porting of Kid templates it would be nice to also support strings in gettext function calls. So I created the attached patch to collect them.

But it will currently lead to an error when you actually use gettext function calls (e.g. ${_(u'Translatable string')}) in your Genshi templates, because the gettext function ('_') is not injected into the template namespace yet. See #2039 for this task.

Attachments

i18n-genshi-expr-collect.diff Download (4.8 KB) - added by Chris Arndt 8 years ago.

Change History

comment:1 Changed 8 years ago by Chris Arndt

  • Status changed from new to assigned
  • Summary changed from [PATCH] Colelct translatable string in explicit gettext function calls in Genshi templates to [PATCH] Collect translatable strings in explicit gettext function calls in Genshi templates

Changed 8 years ago by Chris Arndt

comment:2 Changed 8 years ago by Chris Arndt

  • Milestone changed from 1.1 to 1.1.x bugfix

Moving to 1.1.x bugfix release in preparation for 1.1rc1 release.

comment:3 Changed 7 years ago by Chris Arndt

  • Milestone changed from 1.1.x bugfix to 1.1.1

comment:4 Changed 7 years ago by Chris Arndt

  • Status changed from assigned to closed
  • Resolution set to fixed

Applied in r6977 (with some corrections).

Note: See TracTickets for help on using tickets.