Hi all,

I've a MARKUP webform component, that contains HTML (some <p> and a link <a href...)

When I translate this component, using i18n_string translation, the html is converted in printable font, e.g:

<p> becames &lt;p&gt;
<a becames &lt;a

and so on. In this way the HTML si printed out as a string on my page.

What's wrong?!?!

Thank you very much

Comments

mxt’s picture

Issue summary: View changes

Formatting error

stella’s picture

Status: Active » Needs review
StatusFileSize
new1.02 KB

Patch attached that fixes this, but should possibly be extended to other component types, not sure.

GDrupal’s picture

@stella thanks for this! Will be posting the review soon.

GDrupal’s picture

Status: Needs review » Closed (fixed)

Committed! thanks you all ;)

mxt’s picture

Yes, I can confirm that the patch works well.

Thank you very much!

mxt’s picture

Issue summary: View changes

I've to learn to use the

bc’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Seeing as webform uses its own filter (webform_filter_xss), what responsibility should webform_localization have for filtering?

I'm currently building a site with webform descriptions that contain HTML tags specified in the webform_allowed_tags variable. As a stopgap fix, I've added a condition in includes/webform_localization.i18n.inc:

diff --git a/includes/webform_localization.i18n.inc b/includes/webform_localization.i18n.inc
index ea8ea02..ff757bf 100644
--- a/includes/webform_localization.i18n.inc
+++ b/includes/webform_localization.i18n.inc
@@ -79,6 +79,9 @@ function _webform_localization_translate_component(&$element, $component) {
             if ($property == 'markup' && $current_element['#type'] == 'markup') {
               $current_element['#' . $property] = i18n_string($name, $current_element['#' . $property], array('format' => $current_element['#format']));
             }
+            elseif ($property == 'description') {
+              $current_element['#' . $property] = i18n_string($name, $current_element['#' . $property], array('format' => 'full_html'));
+            }
             else {
               $current_element['#' . $property] = i18n_string($name, $current_element['#' . $property]);
             }

This is overkill, as the string is run through the full_html filter as well as filter_xss/webform_filter_xss

In addition to #description, webform also uses webform_filter_xss on #field_prefix, #field_suffix, #title, as well as a bunch of grid strings.

Any thoughts on this?

bc’s picture

StatusFileSize
new904 bytes
mvc’s picture

Status: Active » Fixed

@bc: moved this to a new ticket rather than hijacking a fixed one, see #2223335: Translation of component description: HTML escaped

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.