Jump to content

Different language for Facebook Like button


Recommended Posts

Hello,

I am using PS 1.5.4 default theme, and I am adding a facebook "Like" button, and I want to display different buttons for differnet languages. Official facebook page says that I just need to change a one liner.

 

I have tried adding {if} inside the javescript, but it did not work. I have tried the following, but it does not work. Can someone pleae help me?

 

<li id="share_facebook">
 <div id="fb-root"></div>
 {if ($iso_code == 'en')}
  {literal}
   <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=386759271445638";
    fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));</script>
  {/literal}
 {elseif ($iso_code == 'ru')}
  {literal}
  <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1&appId=386759271445638";
    fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));</script>
  {/literal}
 {elseif ($iso_code == 'fr')}
  {literal}
   <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1&appId=386759271445638";
    fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));</script>
  {/literal}
 {elseif ($iso_code == 'mx')}
  {literal}
   <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=386759271445638";
    fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));</script>
  {/literal}
 {/if}
 <div  class="fb-like"
   data-send="false"
   data-layout="box_count"
   data-width="280px"
   data-show-faces="false"
   data-font="arial"
   border-radius="3px 3px 3px 3px"
  >
 </div>
   </li>

 

Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...