[Resolved] I can't translate table headings using WPML in a View

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 8 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#555428

I am trying to translate a View. The values in the field are translating after I translate the CPT. You can see here the values in the German text add de after the English in my tests: hidden link

If you change the language to German - you can see the text in the table cells change. So the translation system works.

However. I can't seem to translate the table headings (see screenshot) I have attempted to do so, but not change is seen on the front end of the website.

Here is the code for the filter:
[wpv-filter-start hide="false"]
[wpv-filter-controls]

[wpml-string context="wpv-views"]City / Territory:[/wpml-string] [wpv-control field="city-state" url_param="city-state"]
[wpml-string context="wpv-views"]Practices:[/wpml-string] [wpv-control field="practices" url_param="practices" type="select" values=",Project Mantra,Babaji Surya Namaskar,OM Chanting,OM Chanting Workshop,Simply Meditation,Atma Kriya Yoga,Mudra I,Mudra II" display_values="All,Project Mantra,Babaji Surya Namaskar,OM Chanting,OM Chanting Workshop,Simply Meditation,Atma Kriya Yoga,Mudra I,Mudra II"]
[wpv-filter-spinner container="div" position="before" spinner="hidden link"][/wpv-filter-spinner]

[/wpv-filter-controls]
[wpv-filter-end]

Here is the code for the View:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table class="table table-responsive">
<thead>
<tr>
<th></th>
<th>[wpv-heading name="types-field-full-name"]Full Name[/wpv-heading]</th>
<th>[wpv-heading name="types-field-city-state"]City / Territory[/wpv-heading]</th>
<th>[wpv-heading name="types-field-practices"]Practices[/wpv-heading]</th>
<th>[wpv-heading name="types-field-email"]Contact[/wpv-heading]</th>
<th>[wpv-heading name="types-field-languages"]Languages[/wpv-heading]</th>
<th>[wpv-heading name="types-field-travel"]Teaching Options[/wpv-heading]</th>
</tr>
</thead>
<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
[wpv-post-body view_template="Loop item in Sadhana Teachers List"]
</wpv-loop>
</tbody>
</table>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<div class="alert alert-info">[wpml-string context="wpv-views"]No results. Try to change your search.[/wpml-string]</div>
[/wpv-no-items-found]
[wpv-layout-end]

The problem seems to be with the wpv-heading name e.g: <th>[wpv-heading name="types-field-full-name"]Full Name[/wpv-heading]</th>

How do I use WMPL to translate this text?

#555495

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Seb,

Please try this, use WPML shortcode [wpml-string] to wrap those strings you want to translate, for example, replace this line from:

<th>[wpv-heading name="types-field-full-name"]Full Name[/wpv-heading]</th>

To:

<th>[wpv-heading name="types-field-full-name"][wpml-string context="wpv-views"]Full Name[/wpml-string][/wpv-heading]</th>

And test again, more help:
https://wpml.org/documentation/getting-started-guide/string-translation/