Multilingual search

Hello guys,

I am trying to get my head around the translation of the search forms for my website based on the Shapely theme. See attached: what is your advice for making sure those strings can be translated (I am using Polylang). I guess I need to create a custom search form?

Thanks in advance!

Antonio

Hello Antonio

Well, yes they are supposed to translate so you have to try at least :slight_smile:

OK :wink:

So I have installed the plugin “Polylang Theme Strings” and “Theme and plugin translation for Polylang (TTfP)”.
I could find and translate the string for the Search button, but the placeholder “type here” does not appear in the list of strings I can translate.

I have then created nl_NL.po and nl_NL.mo and provided a translation to the “Type here” string.
But after all this, the placeholder in the search form does not translate when switching language.

Am I missing something else?

Thanks in advance!

A.

Hello,

I hope you are doing well today.

Here is a plugin that provides some more information on using Polylang:

https://polylang.pro/doc/strings-translation/

Another option is to use a plugin like Say What :

Best Regards,
Support

Dear support,

Thanks for your swift reply and advice.
I found a solution.
I copied the extra.php file in my child theme and therein I modified from esc_html__( ‘Type Here’, ‘shapely’ ) to e( ‘Type Here’, ‘shapely’ ).
This makes the string “Type here” visible in the list of strings I can translate.
Strange that for the button name, esc_attr
_( ‘Search’, ‘shapely’ ) is making the string “Search” visible for translation…

Let me know if you have any comment on my solution.
Thanks!
Antonio

Hello,

Nice work finding a solution. You should use a plugin to make a backup just in case the changes you make cause an issue down the line:

Best Regards,
Support