# HG changeset patch # User Thierry Florac # Date 1542726536 -3600 # Node ID 00334308efd46ddbde9e8b270a51e0820f408322 # Parent a6429e91f09105f3d61b39ecec2a80dc75761de4 Added property to get contact button label diff -r a6429e91f091 -r 00334308efd4 src/pyams_default_theme/component/paragraph/contact.py --- a/src/pyams_default_theme/component/paragraph/contact.py Tue Nov 20 15:40:17 2018 +0100 +++ b/src/pyams_default_theme/component/paragraph/contact.py Tue Nov 20 16:08:56 2018 +0100 @@ -21,6 +21,7 @@ from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_default_theme.component.paragraph.interfaces.contact import IContactParagraphDefaultRendererSettings from pyams_default_theme.features.renderer import BaseContentRenderer +from pyams_i18n.interfaces import II18n from pyams_skin.layer import IPyAMSLayer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config, get_annotation_adapter @@ -87,3 +88,10 @@ else: context_attrs = ('name', 'photo', 'company', 'address', 'phone_number', 'contact_email') i18n_context_attrs = ('title', 'charge',) + + @property + def button_label(self): + label = II18n(self.settings).query_attribute('button_label', request=self.request) + if not label: + label = self.request.localizer.translate(_("contact-button-label", default="Contact")) + return label