08/25/2016 at 7:26 am #387752
I hope you are well.
Our client has their websites in 4 languages (eng, french, spanish, portuguese)
We just need to add their “Job Title” in each language.
We are using WPML for translations, and have raised this ticket with them as well.
When we use WPML “String Translation” to attempt to translate, we can only see the user/admin fields. We don’t want to translate the plugin itself. Just enter the job title for the Person, in some different languages.
Any experience with this process or advice that we should follow? At the moment it’s just in English for every site, with apparently no way of adding the other languages.
Greg08/30/2016 at 11:28 am #388242
I believe my support ticket may have been missed as I see many others have been answered in the meantime.
Please could you give it some attention? I have spoken with WPML about the issue too, they find some strange behaviour from Connections custom post type/
Here is the thread:
Thank you08/30/2016 at 1:07 pm #388310
Apologies! I somehow did miss this.
I’ve read the thread over in the WPML support forum…
I guess the first thing that needs to be clarified is that Connections is not a custom post type (CPT). Connections uses custom database tables instead for a couple reasons. One, Connections is older than the WP CPT feature. Two, and more importantly, the db schema of the custom tables are more optimized for directories whereas CPT’s are optimized for post content. This allows me to do things which are difficult is not possible if I were to use a CPT. This is very likely you are not seeing what you need to see in WPML.
Looking at the WPML developer docs, it seems, I think I would have to add specific support in the code for WPML support for user input as outline in their docs.
I could not find anything in their dev docs specifically outlining the procedure to add WPML support to plugins which use custom tables and with user input. I’m not able to ask questions in their support forum since I’m not a customer. If you could relay this question to them asking them to point me to the relevant docs. I can at least add initial support for the job title field.
If this will help them, the code to get and set the job title can be found in these two links:
The actual data is retrieved and saved from the db using the WordPress wpdb API.
I hope this helps move this issue forward to resolution. Let me know what you find out.08/31/2016 at 6:13 am #388413
I will relay this to them and let you know what they come back with,
Greg12/08/2016 at 8:50 am #402721
I hope all is good. This thread got lost for a while, but I’m keen to pick it up with you and WPML
In response to the above, WPML said:
“Let Steven know he could create a manual xml file with the set strings names which would force WPML to register them in the String Translation table. Then he would have to program the translation to force them to use his own domain.
The best way to get in touch with our developers to make this plugin compatible is to join our Go Global Program (https://wpml.org/documentation/theme-compatibility/go-global-program/). Feel free to forward this to him and have him fill out that form so we can start working together.”
Does that seem do-able?
Thanks, all the best
Greg12/22/2016 at 10:39 am #404649
When they say create an XML file, I assume this is what they are talking about from their documentation:
It sounds like you would need to create this XML file… I can’t create an XML file containing string I do not exist in my code. But I do not think this is a solution based on their docs.
You want to translate the actual contents of the job title field, correct? Only you have those strings because they exists only in your database. The field label itself can already be translated, if that is what you are asking about, as the plugin is completely localization ready. It has been for a long time now and is.
Now if we are talking about the field content, it does not appear that an XML file is the solution, that seems to be only required for the static strings in the plugin.
I’m unable to find any documentation which covers how to make field contents translatable for content which exists in custom tables. Everything seems to focus on post/page/widget/taxonomy content. If there was some type of filter or function I could apply to the string before being displayed, I would more than happily apply it but I simply can not find any documentation which covers exactly what you are asking to be done.04/19/2017 at 5:54 am #420446
I spoke with the WPML developers. Their reply was:
Hi Greg, he will need to work directly with our developers to get these answers. To do that, he should join our Go Global Program (https://wpml.org/documentation/theme-compatibility/go-global-program/).
Feel free to forward this to him and have him fill out that form so we can start working together. Once this form is filled out, our developers will get in touch and then they can answer his questions.
Please let me know if you need any further assistance and I will be happy to help.
Does this sound like something you are able to do soon? Or are you already any closer to WPML compatibility?
It would be great to get your plugin working with WPML, it seems a real shame because I can see people (myself included) have been asking about it for 3 years, looking at support queries for “WPML” back to 2014…
Thanks and best wishes,
Greg04/19/2017 at 6:14 am #420448
Hi Steven, further to previous, I followed some advice from a fellow poster, found here:
I can confirm that this solution, whilst a not particularly elegant workaround, does indeed work great. However, as they have stated, it only works on the Bio & Info fields which are full tinymce text fields (possibly not the correct description)
It doesn’t work on any other field, ie job title. the shortcode gets rendered out as text.
If there were a way to just make the “TITLE” field in Connections compatible with shortcode entry, it would satisfactorily fix our challenge.
Any thoughts on this? Thanks and best wishes.
Greg04/19/2017 at 9:35 am #420482
I’ve scoured the WPML docs several times… usually when this issue pops up again. I can not find anywhere in there docs where they document how to enable support for data stored in custom WordPress tables which contain user generated content. The closest I could find was how to accomplish it for text widgets which does not seems to cover this use case.
Unfortunately when there users ask this question of them they seem to only get the bog standard answer to have the dev join their program :/
Add shortcode support to the title field whole doable will not be of much actual use. The database field which saves this sata is limited to only 255 characters (roughly, it is actually 255 bytes, charact can be more than a byte).
To add shortcode support, I think, this would work…
class.entry-output.php file. Change lines
$org = $atts['show_org'] ? $this->getOrganization() : ''; $dept = $atts['show_dept'] ? $this->getDepartment() : '';
$org = $atts['show_org'] ? do_shortcode( $this->getOrganization() ) : ''; $dept = $atts['show_dept'] ? do_shortcode( $this->getDepartment() ) : '';
This is completely untested…