#138 closed enhancement (fixed)
provide some babel genshi extractor configuration to extract as msgids only strings in _()
Reported by: | reuleaux@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.4.4 |
Component: | Internationalization | Version: | 0.4.2 |
Keywords: | Cc: |
Description
In new projects for strings not to be translated one can mark them with xml:lang="..." like so
<p>foo</p> <p>bar</p> <p xml:lang="en">don't translate me</p>
so pybabel will only pick up foo and bar as msgids.
However in older projects (that I want to convert to babel now) I have templates with explicit uses of _() like so
<p>${_('foo')}</p> <p>${_('bar')}</p> <p>don't translate me</p>
pybabel extract extracts the msgids foo, bar and "don't translate me" however I only want foo and bar to be extracted (without editing the templates).
Christophers has already made some suggestions to my description of this problem on the babel mailing list, so I am just citing him here:
It might be best for us to add an additional option to the Genshi extractor for this use case, so that you could define:
[genshi:**.html] extract_text = false
Or allow for a magic value of the "ignore_tag" option:
[genshi:**.html] ignore_tag = * include_attr =
Change History (2)
comment:1 Changed 17 years ago by cmlenz
- Milestone changed from 0.5 to 0.4.4
- Resolution set to fixed
- Status changed from new to closed
comment:2 Changed 17 years ago by cmlenz
- Component changed from General to Internationalization
The extract_text option described above was added in [708], and ported to the 0.4.x branch in [709].