1

In D9 website I have a view with Global: Custom text field. In that field I have placed a string like this:

<span class="general-info">{{ 'General Info:'|t }}</span>

I want to add a translation for the string 'General Info' in different languages. So I went to this translation interface (en/admin/config/regional/translate), where I searched for the string but I could not get the result. Is there any way to refresh the list of "source string" ? I have also cleared the cache and run the cron, but after clicking filter, it displayed "No strings available."

Am I missing something ?

Translate Interface

1 Answer 1

3

The straightforward way would be to translate the field in Configuration Translation. Create a translation of your View and then drill down to the field and translate the rewrite result text of the custom text field.

But your approach, using the User Interface Translation system inside of Twig, should work as well. The trick is, once you have implemented the |t filter in the Twig template, you have to visit the page in one of the installed non-English languages. Then you should be able to find the string in the user interface translation UI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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