Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1393248

    RedactiePartners
    Participant

    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,
    Patrick

    #1393988

    Rad
    Moderator

    Hi 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.

    #1394988

    RedactiePartners
    Participant

    Does 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

    #1395134

    Christian
    Moderator

    That will work only for predefined text. Please contact WPML support for further investigation.

    Thanks.

    #1399337

    RedactiePartners
    Participant
    This reply has been marked as private.
    #1399940

    Rad
    Moderator

    Hi 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!

    #1400439

    RedactiePartners
    Participant
    This reply has been marked as private.
    #1401095

    Rad
    Moderator

    Hi 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!

    #1401609

    RedactiePartners
    Participant
    This reply has been marked as private.
    #1401641

    Rad
    Moderator

    Hi 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!

    #1401776

    RedactiePartners
    Participant

    Hi,

    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.

    #1402256

    Rad
    Moderator

    Hi 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.

    #1403113

    RedactiePartners
    Participant

    I 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.

    #1403442

    Rad
    Moderator

    Hi 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_left

    Hence, 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!

    #1404612

    RedactiePartners
    Participant
    This reply has been marked as private.