How to localize Facebook like button

sarathlal s asked on July 10, 2014 02:00

How to localize facebook like button? I added face book like button transformation in my page

But it is showing only English "Like" in all languages. How can i chage this according to language? Please guide me

Recent Answers


Brenden Kehren answered on July 10, 2014 12:30

You'd have to modify the webpart. I'd suggest cloning it over modifying it (best practice). The webpart can be cloned in the UI but you will have to make modifications in the actual code files after you've cloned it. You can find the files here: /CMSWebparts/SocialMedia/Facebook/FacebookLikeButton.ascx

Now remove the default value of "like" in the VerbToDisplay property (about line 127 in the webpart code). Then in the Localization application, create 2 new keys: custom_fblike and custom_fbrecommend. Now go back to your webpart and in the VerbToDisplay property, change the values in the dropdown from

like;Like
recommend;recommend 

To

custom_fblike;Like  
custom_fbrecommend;Recommend

Now in your webpart code, where ever VerbToDisplay is used wrap it with this ResHelper.GetString(VerbToDisplay). This will get the resource string you entered in the localization application. Now if you want to add addional items for the user to select, simply add another dropdown item and the resource key and value.

You may also want to add some validation to ensure that some value is returned so maybe use the ValidationHelper.GetString() function and return a default if nothing is found.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.