#40172 closed defect (bug) (invalid)
Search form is not translated.
Reported by: | Dreamsorcerer | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7.3 |
Component: | I18N | Keywords: | |
Focuses: | ui | Cc: |
Description
There are 3 translatable strings for the form field found here:
https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/general-template.php#L223
But, testing against Esperanto, which is 100% translated, these strings are not getting translated.
I can see that the label and input box will be translated if you remove the context (using __()
instead of _x()
), but I can see there is no translation for the placeholder in the .mo file.
Change History (6)
#1
@
8 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
#2
@
8 years ago
- Resolution worksforme deleted
- Status changed from closed to reopened
OK, I've updated the translations, and I can see the translation exists in the .mo file. But, it is still not working, in fact, it doesn't look like the admin is translated either.
I've edited (temporarily) the form in general-template.php file, and can see the changes appear on the site, so it is definitely pulling the form from there.
I've tried disabling all plugins to no effect. Which theme are you using to test this on, so I can see if it is a problem with the theme? Or, any other suggestions where I might look for this?
#4
@
7 years ago
OK, took some more time digging into this and finally got an idea of what is breaking. It seems that the parsing of the MO files is incorrect when a translation includes a msgctxt
.
In regard to my original bug report, you will see in the eo.po file the below translation:
#: wp-includes/general-template.php:213 msgctxt "placeholder" msgid "Search …" msgstr "Serĉi …"
What happens is that at wp-includes/pomo/mo.php:265
, $original
is set to placeholder\x04Search …
.
Which means that calling __('Search …')
fails, as that key does not exist, however __('placeholder\x04Search …')
works correctly.
Likewise, Contact and Blog appear under Theme starter content\x04Contact
and Theme starter content\x04Blog
respectively.
So, this explains why random parts of my site are not translated. It may also explain why you were unable to reproduce the issue, if your theme is using the Search
string, as that translation works correctly for me. So, please confirm if you are now able to reproduce the issue by testing if __('Search …')
returns the correct translation: Serĉi …
.
This latest debugging session was done on WP 4.9.
Hello @Dreamsorcerer, welcome to Trac!
Thanks for you report. I couldn't reproduce this issue. Please make sure that you have the latest translations installed. You can replace yours with the ones from https://downloads.wordpress.org/translation/core/4.7.3/eo.zip.
Themes like Twenty Seventeen are also using their own search form template so make sure that the theme translation is also updated (https://downloads.wordpress.org/translation/theme/twentyseventeen/1.0/eo.zip).