0

What is the best way to translate the title in search template file

I use a commercial theme. In :

page--search.html.twig

I can modify the tytle by replacing :

 <h1>{{ title }}</h1>

by

<h1>Recherche</h1>

It works but it is obviously not the best way.

Since search result page is not a node, where is this title ?

I’ve searched in blocks, content, module and I can't find this title.

3
  • Have you turned on translation and installed the French language? Commented May 17, 2017 at 11:01
  • @AlfredArmstrong No, i didn’t. It might be the solution ? Commented May 17, 2017 at 11:56
  • @AlfredArmstrong Activate the language module and add a second language was the solution. I will vote for you if you post an answer. Commented May 17, 2017 at 12:31

1 Answer 1

1

Drupal 8 has extensive multi-lingual support and French is one of the supported languages.

As administrator, turn on the language module at Administration -> Extend

Then go to Administration -> Configuration -> Regional and Language -> Languages, click on Add Language and select French. If you want it to be the default language set it as the default and Save Configuration. (This can cause issues if the site is already live!)

The User Interface Translation module (also in core) can be used to import additional translations and to allow you to translate strings manually as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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