I want the button (facebook) to be displayed in different languages, tried as follows:
if(window.location.href == '/lv/'){ js.src = "//connect.facebook.net/lv_LV/sdk.js#xfbml=1&version=v2.6&appId=491659391035911"; }else if(/ru/.test(window.location.href)){ js.src = "//connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.6&appId=491659391035911"; }else if(/lt/.test(window.location.href)){ js.src = "//connect.facebook.net/lt_LT/sdk.js#xfbml=1&version=v2.6&appId=491659391035911"; }else if(/et/.test(window.location.href)){ js.src = "//connect.facebook.net/et_EE/sdk.js#xfbml=1&version=v2.6&appId=491659391035911"; }else{ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appId=491659391035911"; } This is not working correctly, for example, instead of English, Lithuanian displays, advise how to do it right?
window.location.href. Most likely you needlocation.pathname, but even in this case it’s impossible to check the exact match is pretty stupid. - Alexey Ten