Skip Navigation

[Resolved] Using qTranslate with Types

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 11 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 6 replies, has 2 voices.

Last updated by Joff 11 years, 3 months ago.

Assisted by: Caridad.

Author
Posts
#30239

I'm trying to add multi-lingual support to my Types through qTranslate but I'm having trouble with implementing the shortcode in a View. I've tried adding the [:en]-style shortcode to both the view (surrounding the Types field shortcode) and within the Types field itself.

The closest source of info I've found was https://toolset.com/forums/topic/types-and-qtranslate/ but there's no mention of how the solution was found.

#30364

Dear Joff,

There was no solution mentioned in that thread, just the fact that WYSIWYG fields wont work with qtranslate. Can you manage without them or do you need them?

Regards,
Caridad

#30431

Hi Caridad, I really do need them in this instance I'm afraid. The fields I'm using are all single line so I had hoped that qTranslate would work one way or another, either with the qTranslate shortcode within the field itself or as part of the View template but neither approach seem to work.

#30656

Dear Jeff,

QTranslate will only modify the title and the content for you to input the different languages. You can have multilingual fields by using QTranslate special notation, for single line fields it has to work:

<!--:es-->Spanish Name<!--:--><!--:en-->English Name<!--:-->

Later, to print the value of this field in a template file you have to use the __() so that QTranslate gets a chance to filter it:

<?php echo __(types_render_field('buildingname', array())); ?>

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#31457

Hi Caridad, thanks for that but is there a way to print the value of the fields within the View/Content Template?

#31627

Dear Joff,

Yes, with the types shortcode:

[types field="buildingname"][/types]

To run all these strings through the QTranslate filter you might need to add some code to functions.php in your theme:

add_filter('wpcf_fields_value_display', '__');

Please let me know if there is anything else that I can assist you with.

Regards,
Caridad

#31636

Hi Caridad, many thanks the filter has resolved my issue.

For reference if anyone else is trying to achieve the same, use the filter above with the Types special notation, e.g.

<!--:es-->Spanish Name<!--:--><!--:en-->English Name<!--:-->

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.