Search code examples
internationalizationpyramidpylons

How to translate select option elements in Pyramid?


Until only a few minutes ago I was using this syntax to translate a select element, and then I found out that these strings (contents of the <option/> elements) are not being captured in the generation of the .pot file, therefore not being added to the strings for translation list.

<select name="sel1">
    <option i18n:translate="all">All</option>
    <option i18n:translate="new_releases">New Releases</option>
</select>

I am running versions Pyramid 1.5.2, Lingua 3.9, Babel 1.3

What should be the correct way to translate these <option/> elements?


Solution

  • The problem here (after talking about this on irc) is the command used to extract messages from a template: you are using Babel's update_catalog command. This is no longer support in current versions of lingua: lingua now has its own extraction framework. That means you need to use lingua's pot-create command instead.

    The lingua documentation explains why lingua no longer uses Babel, and has documentation and examples for using pot-create.