0

In WPML some times custom widgets developed could not get translated.

Any string is translatable if the you copy paste the string then that string if searchable in WPML is translatable.

I have a website that has 4-5 Custom widgets + some hard coded part

For example there was a string in hard coded part-

Bet on your favorite sports online

I made it WPML compatible- WPML version

N.B. Before posting the question here I have invested around 3-4 hours in understanding all the FAQ's at wpml.org site.

My problem-

I have various widgets, one such widgets has this portion-

<div class="signupoffers">
        <div class="signupText"> <h2><?php echo $signup_text_title?></h2>
            <p><?php echo $signup_text_content?></p><br>
        </div>
        <div class="signupbuttonDiv">
            <div class="RegisterBlock">
                <div class="block"><h2><?php echo $signup_btn_title?></h2>
                    <div>
                        <?php echo $signup_btn_content; ?>
                    </div>
                </div>
            </div>
            <?php //nsu_signup_form();?>
        </div>
    </div>    

Lets take an example this one- I tried this http://screencast.com/t/3hJCPJgylXS but the above one doesn't worked.

and various other versions, but no help so far.

Content here is coming dynamically from widget entry. May be I have some syntax issue. Does any one has encountered such situation before, Please guide me how to do that. Thanks!!

  • Actually the code that I have shown in screencast was not getting posted properly thats the reason I have used screencast. – user1864913 Dec 04 '14 at 19:11

2 Answers2

0

Let me ask the question in different way- The string here is coming in a dynamic format-

<h2><?php echo $signup_btn_title?></h2>

How to convert it into wpml version so that wpml can read and search this string.

I tried this one, but it didn't worked-

<h2><?php _e('(<?php echo $seocontent_text_title;?>)','Casino'); ?></h2>
0
<h2><?php _e('(<?php echo $seocontent_text_title;?>)','Casino'); ?></h2>

this is definitely wrong

If any of similar approach, it should read similarly to this:

<?php _e( $seocontent_text_title, 'your_text_domain' ); ?>

You would probably also need to edit/create a wpml-config.xml file.

You could also try something along this lines: (icl_translate function in strings)

<?php echo icl_translate(context, name, value); ?>">

I think this could help you to understand further:

https://wpml.org/forums/topic/transform-echo-to-php_e/

https://wpml.org/documentation/support/translation-for-texts-by-other-plugins-and-themes/

https://wpml.org/documentation/support/wpml-coding-api/