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 #2498 (closed defect: migrated)

Opened 9 years ago

Last modified 8 years ago

[PATCH] Use Genshi's new "advanced i18n"

Reported by: Clicky Owned by:
Priority: low Milestone: 2.1
Component: TurboGears Version: trunk
Severity: trivial Keywords:
Cc:

Description

Starting with version 0.6, Genshi has a new "avanced i18n" mechanism which lets you translate complex pieces of HTML markup with embedded text.

Eg.

<p xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:msg="name">
  Please visit <a href="${site.url}">${site.name}</a> for help.
</p>

Without the extra i18n namespace & attribute, this piece of markup would get extracted as 2 separate strings ("Please visit " & " for help."). Using the extra namespace, this is extracted as "Please visit [1:%(name)s] for help.", which makes a lot more sense for translators.

Using this new feature only requires the additional i18n directives be loaded when parsing a template (when TemplateLoader's callback is called). The attached patch adds the necessary code to handle this (taken from genshi.filters.Translator:setup, which I didn't call directly to avoid breaking compatibility with pre-0.6 versions of Genshi).

More information on this new feature can be found here:
 http://genshi.edgewall.org/wiki/Documentation/i18n.html#id1

Please comment on this.

Attachments

genshi_0_6_advanced_i18n.diff Download (639 bytes) - added by Clicky 9 years ago.
Patch for Genshi advanced i18n

Change History

Changed 9 years ago by Clicky

Patch for Genshi advanced i18n

comment:1 Changed 9 years ago by chrisz

  • Milestone changed from __unclassified__ to 2.1rc1

comment:2 Changed 9 years ago by percious

  • Milestone changed from 2.1rc1 to 2.1

comment:3 Changed 8 years ago by pedersen

  • Status changed from new to closed
  • Resolution set to migrated
Note: See TracTickets for help on using tickets.