Translating text string in page template elements added using JavaScript

Hello,

I developed a CT with about 60 fields. Due to the large number of fields the default AddView gets too long. Thats why I added some JavaScript to build an accoordion on the default view. This is done by wrapping some fields with div-Elements and adding a number of buttons. The problem is that the titles of the accordion buttons are not translated. I've tried to declare XML namespace i18n and translation domain to each button but the labels which need to be translated are not added to the .pot files.

Any other ideas how translate text strings added by JavaScript? Thanks in advance!

With plone.restapi and and content negotiation you get the types schema with already translated titles, see
https://plonerestapi.readthedocs.io/en/latest/types-schema.html
https://plonerestapi.readthedocs.io/en/latest/i18n.html

[edit] Well, sorry, twice reading the question my answer its not what you asked.

[edit2] You're probaly looking for manual translation, see https://docs.plone.org/develop/plone/i18n/internationalisation.html#manually-translated-message-ids

hi @jensens

thanks for the reply. I've tried manual translation before and it didn't work. I used TAL-attributes to call the "translate" method for my accordion buttons but it seems like TAL-attributes are not working in the HTML elements added with javascript.

@brenaav have to looked at fieldsets? The allow you to easily put your
fields into tabs -
https://docs.plone.org/external/plone.app.dexterity/docs/reference/form-schema-hints.html

1 Like