Ticket #70 (closed defect: invalid)
search query value should not be translated
| Reported by: | datapharmer | Owned by: | ofer |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.5 - Beta wordpress plugin |
| Component: | Parser | Version: | 0.3.7 |
| Keywords: | search, query, value, global, search results | Cc: |
Description
the global value $s is being translated on the search results page. This should not happen because it can cause confusion. For example if I were to search the spanish language version of my site for the spanish word "red" it comes back saying that I searched for "rojo", which is literally red in spanish, but that is not what I wanted results for (it is ok that results may contain pages that contain the word rojo at this point - natural language cannot be reasonably interpreted from a single word), but the search query should retain the original query.
Change History
comment:2 Changed 2 years ago by datapharmer
I see the predicament... Not sure about fixing this for everyone, but a preg_replace could be done for common items such as fields with ids or values of "s" and occurrences of things such as
echo wp_specialchars($s);
Where it would place a no_translate span around the term(s) or fields as appropriate.
I think it might be a matter of covering the obvious and waiting for any bug reports to fill in anything that gets missed. You are right though, it is probably impossible to get this problem corrected for 100% of cases.

The solution here is both simple, out of our hands and complicated at the same time.
Why simple?
Because in the search section of the template you just need to surround the $s with a span class no_translate to fix this
Why out of our hands?
When we get to translated this, we really can't tell this was a $s originally
Why complicated?
There is no way I can think of to fix this for everybody, any ideas here?