Skip Navigation

[Resuelto] Contet templates doesn't translate.

This support ticket is created hace 2 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Este tema contiene 11 respuestas, tiene 3 mensajes.

Última actualización por Waqar hace 2 años, 4 meses.

Asistido por: Waqar.

Autor
Mensajes
#2420471

I try to create a multilingual site with types, views and content templates.
Types and views seeems works correctly but content templates doesn't translate.
We are using Toolset and WPML.

Is there any documentation that you are following?
https://toolset.com/course-lesson/translating-views-content-templates-archives-and-forms/

#2420645

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Can you share more details about what exactly doesn't work?

Do you mean you cannot send Content Templates to translation? Or you translate them, but the results on the front end are not as expected?

Ordinarily it is not necessary to translate Content Templates. If your template outputs fields from some posts, you translate the posts rather than the template, and which language you see on the front end is determined by the current language. If the template outputs the post title, when displaying French posts the title would be output in French; when displaying Spanish posts, the title would be output in Spanish.

So you would translate Content Templates when you want them to output different things or the same things differently for different languages. For example, if on the French page you wanted to display the featured image on the left and some text on the right, but on the Spanish page you wanted the text on the left and the image on the right.

Also you would translate the template if it contained static text (e.g. a normal Heading block with static text, rather than a Toolset Heading block displaying dynamic text from the post).

In any case, can you please clarify what you mean when you say the content template doesn't translate?

#2420673
2022-07-19_13h05_36.png

As you can see in the image i translated the content templates to English and Dutch. But all the content templates are not translated in the frontend.

I have selected in wmpl translate all for "Content Templates".

I show you and example.

enlace oculto

#2420743
2022-07-19_13h45_31.png

I find the oposite error. Probably can help. Look at the header.

enlace oculto

#2421409

Thank you for sharing these details.

To troubleshoot this, I'll need to see how this content template and its translation are set up in the admin area.

Can you please share temporary admin login details, in reply to this message?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

#2422355

Thank you for sharing the admin access.

I'm currently running some tests on my website, based on the settings similar to your website.

Will share the findings, as soon as this testing completes.

Thank you for your patience.

#2423245

Just wanted to let you know that I'm still working on this and will share the findings, within the next few hours.

#2424395

Thank you for waiting.

I reviewed your website's setup and performed tests on my website over the weekend and here are the findings.

The correct translated version of a content template is automatically used when it is assigned to a page/post, but not when it is being called inside the content without assignment.

In that case, you'll need to specify the translated template's name/slug when translating the page's content.

For example, when translating a content template, you'll also see the option to translate its title.
( screenshot: enlace oculto )

Instead of using the same content template title for all languages, you'll set the different titles with respect to each language.

After that, when editing the page's translation, you can set that translated name in the respective language in the content template's shortcode.
( screenshot: enlace oculto )

Note: In your WPML languages, the labels for the languages are not set correctly, which can result in confusion.
( screenshot: enlace oculto )

You can see this by going to WP Admin -> Languages and to fix this, you can update the language labels using the "Edit Languages" option.
( screenshot 1: enlace oculto )
( screenshot 2: enlace oculto )

#2424575

Thanks.

How can I know the id or the slug of the translated content template?

I try to change the Name of the conten template of the translation

enlace oculto

And change the template shortcode in the tranlation box, where it has to be displayed and the only we achieve is nothing is displayed instead of display the translated content template.

enlace oculto

After that i try to put other template in the default language and nothing is displayed too.

So how can follow your suggestion? How can I know the id or the slug of the translated content template?

#2424603

Thanks for writing back.

When the "wpv-post-body" is used to call a content template, its "view_template" attribute supports either using the template's name/title or the slug (and not the ID):
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body )
( screenshot: enlace oculto )

The content template slug is visible in the classic/legacy template editor ( screenshot: enlace oculto ), but not in the blocks-based editor. So in that case, it is best to use the content template's title/name in the "view_template" attribute.
( screenshot: enlace oculto )

#2424839

We translated al lthe content templates. But we found a new issue in them. In the intro of this both pages

enlace oculto
enlace oculto

enlace oculto
enlace oculto

When you change de shortcode and add the correct in dutch the spanish is translated to dutch too. The other content templates are right now.

#2425207

During troubleshooting, I noticed that although the content templates that you're using now have translated names/titles, their slugs are still the same.

The content template slugs are created at the time of creation and there is no simple control available to update them, once created. This is why it is important that unique translated titles are set for the content templates, at the time of first translation.

The "Content Template" block depends on this slug, to call the template, which is why when they are the same, it shows them in the incorrect language.

To overcome this for any template that is not showing in the correct language, you can remove the "Content Template" block and in its place add a "Fields and Text" block.

In that block, you can call the desired template, using the name/title and not the slug, through the "wpv-post-body" shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

For example, on your page "Alquiler motos Ibiza", the "Intro Alquiler Motos Ibiza" content template was not showing in the correct language.

I removed the "Content Template" block that was calling this template and in its place added a "Fields and Text" block, with this shortcode:
( screenshot: enlace oculto )


[wpv-post-body view_template="Intro Alquiler Motos Ibiza"]

Next, I updated the translations of this page and updated the translated name/title of the template in the shortcode:

For Nld:


[wpv-post-body view_template="Intro Alquiler Motos Ibiza Nld"]

For Eng:


[wpv-post-body view_template="Intro Alquiler Motos Ibiza Eng"]

Similarly, you can fix any other content template, that is not showing in the correct language.