2

I add a simple text as view header but it is not exists in translatable text in admin/config/regional/translate.

In Drupal 7 we could even translate unformulated views header and footer with the following steps:

  1. Go to admin/config/regional/i18n/strings
  2. Check "full HTML" in "Translatable text formats" section
  3. Go to admin/config/regional/translate/i18n_string
  4. Click on Refresh strings

Has this feature been removed form Drupal 8? (I don't think so.)
How can I translate view header and footer simple text?

3
  • Plain Drupal 7 doesn't have any admin/config/regional/i18n/strings; that is added by the i18n module.
    – avpaderno
    Commented Jun 14, 2016 at 12:11
  • @kiamlaluno I mean with module.drupal 7 by default not support i18n
    – Yuseferi
    Commented Jun 14, 2016 at 13:09
  • There is a thread, that explain config translation: drupal.stackexchange.com/questions/189872/… Commented Jan 19, 2017 at 8:44

4 Answers 4

3
  1. Enable "Configuration Translation" core module
  2. Go to your view edit and you will see a "Translate view" tab
  3. You'll find your language in the list there. Then click on "Edit" next to the language
  4. Expand panels and you will find your header text under the "Header" panel
1
  • 1
    5 years ago( when I asked the question) this option wasn't there ;). thank you for your answer. could be helpful for other guys.
    – Yuseferi
    Commented Jan 6, 2021 at 14:12
1

If my previous answer doesn't work fine. Try with this solution.

  1. In view add new field "Custom text" (Click checkbox Exclude from display)
  2. In "Custom text" add code like this
    <div class="custom-title-and-subtitle">
    <h2>{% trans %}Contact us{% endtrans %}</h2>
    <p>{% trans %}Please contact us for UFME Inquiries only. For vocations and prayer requests, contact the Franciscans in your area.{% endtrans %}</p>
    </div>
  1. In view header add "Unfiltered text" field
  2. Click checkbox "Use replacement tokens from the first row"
  3. Add REPLACEMENT PATTERNS in my case {{ nothing }}
  4. Clear cache And after that you will be able find text in user interface translation "admin/config/regional/translate"

enter image description here

0

You need to use configuration for your language. Example enter image description here

-1

You can easy translate view header and footer text using the {% trans %} Twig tag in Drupal 8 Example:

{% trans %}
  Text for translate
{% endtrans %}

And after that you will be able find text in user interface translation "admin/config/regional/translate"

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.