Current search block does not use plural_text when you display the block in translated version ...

Comments

daniel kulbe’s picture

Additional html-tags get converted into normal text. Totally unwanted!

cpliakas’s picture

Status: Active » Closed (duplicate)

Hi Daniel.

Thanks for posting. These are actually two separate issues and should be their own posts, but I believe they are duplicates so I am closing as such. In addition, they are actually both more relevant to the Facet API project then this one. Please refer to the following issues:

#1728496: Plural text translatable, but no longer shown
#1734730: Taxonomy terms with apostrophe are encoded with "&#39"

Chris

daniel kulbe’s picture

Status: Closed (duplicate) » Needs work

The use of plural text works fine now using the dev version of facet api + current search. Only at the German version (in my case) of the text converts tags like <em> and <strong> to characters.

cpliakas’s picture

Status: Needs work » Active

Could you please post a screenshot of the offending tags being converted to characters? I think I understand what you are saying, but I want to make sure we are on the same page before moving forward.

Also, "needs work" status is intended to be used for patches. Please see the Status settings for an issue for more details. Not a big deal, but it helps bm keeps things organized and allows me to respond more efficiently if things are tagged according to these standards.

Thanks in advance,
Chris

daniel kulbe’s picture

StatusFileSize
new29.76 KB

Sorry for the wrong status! I'm new at Drupal.org ...

So I capured some screenshots:

Screenshots

I use commerce_kickstart_search module that provides current search blocks by code and changed the vocabulary a little bit. I noticed, when I create a current search block by UI the tags also get converted to readable text. But I hoped it would be possible to translate it with the same html tags as the original text.

cpliakas’s picture

Hi Daniel,

Re: the status, not a problem at all, and welcome to Drupal! Glad to have you aboard. We were all new to Drupal.org at one time as well, so I want to help you get the most out of the issue queue as you post against other projects in the future.

Also, thank you so much for the screenshots, I see exactly the problem you are trying to solve now. Let me try to replicate and see if thee is some way to accomplish your goals. The tough part with escaping markup is that if you are too permissive then it becomes an XXS security issue, so let's see if we can get this working in a way that is both secure and configurable.

Much appreciated,
Chris

daniel kulbe’s picture

Thanks for the warm welcome. I think it would be enough to enable just a few highlighting tags like <em>, <strong>, <b> and <i>.

cpliakas’s picture

Title: Currrent search block plural bug » Current Search text items are double escaped when translated
Priority: Normal » Major

OK, I see the issue here. Not only is this value being double encoded by Facet API anyways, but it is being tripple encoded when translated via this module. So that's awesome :-(.

To highlight the issue, the first escaping for translated strings will happen in the i18n module on line 643 in the i18n_string_format() function. The second escaping happens on line 45 of the CurrentSearchItemText::execute() method. The third round of escaping happens on line 28 of the theme_current_search_text() function.

Let me think about how to attach this, but there will have to be some fixes in Facet API as well.

Thanks,
Chris

cpliakas’s picture

Posted issue against Facet API at #1751514: Current search text items are double encoded to track the patches against the core module.

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new673 bytes

The attached patch fixes the extra encoding applied during translation.

daniel kulbe’s picture

This patch solved my problem. Everything is displayed correctly.

cpliakas’s picture

If you apply the patch above to the Facet API Translate module and the one at #1751514-2: Current search text items are double encoded the the Facet API module, it should solve your use case. If the patches work as expected, feel free to change the status in both issues to "reviewed & tested by the community".

Thanks!
Chris

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

I didn't refresh before posting :-) Marking as RTBC based on comments in #1741444-11: Current Search text items are double escaped when translated.

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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