Tell us what you are trying to do? Make content fields in different languages available to the author in the same CRED form accessed in his default language.
Is there any documentation that you are following? https://wpml.org/wpml-hook/wpml_set_element_language_details/
Hello,
Although most of my CP fields are automatically translated, I'd like the free text fields to be available for manual translation by the author in the front-end via CRED. Should the author not enter a translation, then the translated post should either display the text in the original language or nothing (or perhaps an automatic google translation)
I checked the wpml documentation above but am not sure that is the easiest or only solution available and even less sure about how to implement it.
Thanks.
Dear Bruno,
There isn't such a built-in feature within CRED form, one CRED form can only create/edit only one post, but in WPML translated posts, each language version of post is a different post, so you can not use one single CRED form to edit multiple posts (several languages).
You can translate the CRED form into different language, and display the CRED form in different language pages, for the author to edit the text fields. See our document:
Translating Content Templates, WordPress Archives, Views, and CRED forms
https://toolset.com/documentation/translating-sites-built-with-toolset/translating-content-templates-wordpress-archives-views-cred-forms/
Dear Yang,
Thanks for your reply.
Based on that, I imagine the following scenario: create a second CRED form pointing to the post in the second language, but only containing the text fields to be translated; said form would be accessed via a link in the post layout. Would this work, meaning would this form pickup all the other elements (automatically translated from the original form or post? How to?
Thanks again.
When user submit the CRED form for creating post, you can use CRED action cred_save_data to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
in this PHP function, trigger WPML action hook "wpml_make_post_duplicates", duplicate the post into other languages:
https://wpml.org/wpml-hook/wpml_make_post_duplicates/
Then setup CRED form for editing post, and for your user to edit the post in other languages:
https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/
Hello Yang,
Thanks for all the tips; I'll find my way from there and, the case being, open a more specific ticket.
Cheers.