Tagged: cornerstone
-
AuthorPosts
-
March 3, 2017 at 7:32 am #1393248
Hi there,
I have been busy setting up a webpage that will require translations through WPML. Which is fine of course since it is supported.
But I created a couple of custom cornerstone elements. What is the best way to make these work with WPML or is this a WPML thing that identifies existing CS Elements and allows them to be translated.
Would a solution be for me to wrap all my Custom CS Elements text/editor outputs to a ‘wpml-string shortcode’ so it would be translatable by the WPML String Translations?
Kind Regards,
PatrickMarch 3, 2017 at 7:29 pm #1393988Hi there,
Thanks for writing in.
You have to make your strings translatable by using the WP functions from here http://wpengineer.com/2237/whats-the-difference-between-__-_e-_x-and-_ex/
Once it’s translatable, any translation plugin should work.
Example
echo __('HELLO WORLD', '__x__');
Hope this helps.
March 5, 2017 at 5:57 am #1394988Does that only work for predefined text like
echo __('HELLO WORLD', '__x__');
Or can I also use a variable? I want to translate user inputted text like
echo __($element_title, '__x__);
Maybe I am doing something wrong but I don’t see the input appear in my WPML Translation basket
March 5, 2017 at 9:58 am #1395134That will work only for predefined text. Please contact WPML support for further investigation.
Thanks.
March 8, 2017 at 11:13 am #1399337This reply has been marked as private.March 8, 2017 at 7:23 pm #1399940Hi there,
It’s because you’re adding your left and right content as attribute/option where HTML is not allowed. Usually, shortcode data are passed like this
function shortcode_funct($atts, $content) { }
The $content is where standard content and HTML are passed. While $atts is where attribute and options are passed like $content_left and $content_right.
Though, I’d like to see how it’s implemented in your site, would you mind providing your admin login credentials for testing?
Thanks!
March 9, 2017 at 6:23 am #1400439This reply has been marked as private.March 9, 2017 at 3:41 pm #1401095Hi there,
I just checked and it’s already using standard editor instead of just text input. And HTML works, would you mind providing the procedure to reproduce the issue?
Thanks!
March 10, 2017 at 1:28 am #1401609This reply has been marked as private.March 10, 2017 at 2:04 am #1401641Hi there,
It’s correct but you can always improve it 🙂
I just thought you’re using standard inputs for content and they will be filtered removing HTML entities.
About WPML issue, you can’t translate through that. They are content with HTML codes and not standard static texts, and you don’t need to enable it. It’s user responsibility to translate them and not by your plugin, and it’s always manual translation 🙂
Example,
I created HELLO (English) page and added your timeline element with English content, then with the help of WPML, I can duplicate the HELLO page to BONJOUR (french). I will then manually edit BONJOUR page and replace the timeline element content with french content.
Automatic translation isn’t applicable for page contents since the entire page is duplicated by WPML.
Thanks!
March 10, 2017 at 5:44 am #1401776Hi,
The translations work fine that is not the problem.
My issue is that what you see in that screenshot I uploaded 1 post back is that WPML doesn’t know when to use the “visual” Editor (or WYSIWYG editor) for custom cornerstone elements.
So while I implemented the ‘editor’ control. WPML would see it as a single line element and strips all HTML entities by itself.
Making it so that when I load a translated page all HTML is broken and text that was supposed to be a
<ul>
is now formatted text like;>
Next to that I am seeing a lot of other issues with Custom Cornerstone Elements and WPML. But it’s something I am working on if it’s solvable and if it would be solvable it will probably be from WPML’s side.
March 10, 2017 at 2:06 pm #1402256Hi there,
Yes, I see them, but they aren’t needed to be translated that way. It’s part of the cornerstone, and cornerstone output is part of the_content() which is part of an entire page. Manual translation is duplicating the entire page creating a different page for each language.
There is no need to translate each content_left, and content_right through that, users will translate them manually by editing them. If you check other cornerstone’s elements, they don’t do that translation because it’s a content, and it should be in control of users.
Thanks.
March 11, 2017 at 9:16 am #1403113I think I am not following what you mean exactly.
I need both the left and right side to be able to have HTML formatted text (in this case
<strong>
and<ul>
and<li>
. When we translate a page made in Cornerstone to a different language it copies over the cornerstone elements and the content is done by content_left and content_right. But just translating them would not work since it needs the formatting too. (which is misinterpreted).I can also not edit a different language page using cornerstone cause it would remove the content.
I am not sure what to do here then? Or am I just trying to do something that’s not possible?
Many thanks for putting up with me.
March 11, 2017 at 7:20 pm #1403442Hi there,
Yes, but why does it need the content to be translated? That element is going to part of the cornerstone, and cornerstone content is part of page content. And user will translate the entire page content manually.
1. If user created an English page, he will then manually add the English content for content_left
2. If user created a French page, he will then manually add the French content for content_leftHence, why does content_left have to be translated by you(developer) and not by them(users). It seems like you wish to enable automatic translation to a manually added page content. Is that what you’re trying to achieve?
Please note that in WPML, contents aren’t translated that way as your screenshot. Users usually duplicate the page and manually added the content.
Thanks!
March 13, 2017 at 4:44 am #1404612This reply has been marked as private. -
AuthorPosts