-1

In the default theme for Drupal 9 (Olivero) I have the following string in my search box field:

Search by keyword or phrase.

I have tried to change it by going to admin/config/regional/translate (and searching search) and also admin/config/regional/config-translation but nowhere have I found where to change it.

How to change Olivero default search string?

1
  • 1
    I don’t fully understand where you are stuck, whether with translation itself or with this string in particular.
    – cilefen
    Sep 23 at 23:14

2 Answers 2

0

There is nothing special about this string. Here are the exact steps to translate it.

  1. Ensure the Search and Interface Translation modules are enabled at /admin/modules.
  2. Ensure the search block is set to be shown at /admin/structure/block.
  3. Visit a page with the search block. If you never visit a page with the search block, the string will not be generated and will thus not be available for translation.
  4. Go to /admin/config/regional/translate and search for "Search by" (case sensitive). The string will appear for translation.

Again, this process is the same for all strings. The most important point is that you need to view the string once as a user for it to be made available for translation.

1
  • 2
    Thanks, I actually made a search on the phrase search alone but it didn't yield the right result because Search by is case sensitive here.
    – rottermann
    Sep 24 at 14:27
1

It is a translatable string so translation tools should work.

Alternatively you could alter the search_block_form or search_form form (you did not specify which), and change $form['keys']['#attributes']['placeholder'] or $form['basic']['keys']['#attributes']['placeholder'], respectively.

1
  • I don't know to which translation tool you referred. About using a hook, as a non PHP programmer I prefer not to touch the PHP. I think I'll use JavaScript in the end...
    – rottermann
    Sep 23 at 21:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.