wagtail / wagtail-localize

Translation plugin for Wagtail CMS
https://wagtail-localize.org/
Other
216 stars 83 forks source link

`extract_strings` treats custom Draftail inline styles as blocks #778

Open tognee opened 5 months ago

tognee commented 5 months ago

Currently the list of inline tags is hardcoded: https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/strings.py#L9

This won't work when adding InlineStyleFeature using the register_rich_text_features wagtail hook. Adding for example a generic inline style with a span will break it up as different string as if it was a block tag.

The best solution would be to retrieve the features from the richtext instance and follow all the InlineStyleFeature tags and attributes defined.

zerolab commented 5 months ago

@tognee it makes sense. I would make it so we the list is additive. That is, we start with our set list, and add anything in InlineStyleFeature

If you have the time, please do submit a PR. Will happily review