Support » Plugin: Facebook AWD All in one » [Plugin: Facebook AWD All in one] Like button is not localized

  • Resolved Andrea Sciamanna


    This is quite odd.

    Usually the like button and all other Facebook buttons, widgets and boxes are automatically localized.

    With this plugin I always get an English localization.
    Looking to the source code, I don’t see anything that forces the English localization, and still, I can’t get it in the right language (Italian, in my case).

    If I try with the Facebook wizard (from here) I get it in Italian.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author AHWEBDEV


    Yep i will add this feature in the next release…

    For the moment, if you want to localized the plugin (only facebook part) you can.

    You have to go in your plugin folder and open folder “facebook-awd”
    Open the file AWD_facebook.php

    Search for the line n 1021:
    “document.location.protocol + ‘//’;”

    You can see that the localisation is en_US
    If you want french, you can replace us_US by fr_FR

    You can replace it by any lang that exist on facebook.
    I will add some hook and some custom in admin, to set the lang.

    Thank you: this does the job.

    If I may suggest, in the future release I would add, in addition to some hook and custom in admin, an option to automatically detect the languages, based on user’s browser localization.

    Something like that (found in comments about http_negotiate_language, here):

      determine which language out of an available set the user prefers most
      $available_languages        array with language-tag-strings (must be lowercase) that are available
      $http_accept_language    a HTTP_ACCEPT_LANGUAGE string (read from $_SERVER['HTTP_ACCEPT_LANGUAGE'] if left out)
    function prefered_language ($available_languages,$http_accept_language="auto") {
        // if $http_accept_language was left out, read it from the HTTP-Header
        if ($http_accept_language == "auto") $http_accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
        // standard  for HTTP_ACCEPT_LANGUAGE is defined under
        // pattern to find is therefore something like this:
        //    1#( language-range [ ";" "q" "=" qvalue ] )
        // where:
        //    language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
        //    qvalue         = ( "0" [ "." 0*3DIGIT ] )
        //            | ( "1" [ "." 0*3("0") ] )
        preg_match_all("/(:alpha:{1,8})(-([[:alpha:]|-]{1,8}))?" .
                       $http_accept_language, $hits, PREG_SET_ORDER);
        // default language (in case of no hits) is the first in the array
        $bestlang = $available_languages[0];
        $bestqval = 0;
        foreach ($hits as $arr) {
            // read data from the array of this hit
            $langprefix = strtolower ($arr[1]);
            if (!empty($arr[3])) {
                $langrange = strtolower ($arr[3]);
                $language = $langprefix . "-" . $langrange;
            else $language = $langprefix;
            $qvalue = 1.0;
            if (!empty($arr[5])) $qvalue = floatval($arr[5]);
            // find q-maximal language
            if (in_array($language,$available_languages) && ($qvalue > $bestqval)) {
                $bestlang = $language;
                $bestqval = $qvalue;
            // if no direct hit, try the prefix only but decrease q-value by 10% (as http_negotiate_language does)
            else if (in_array($languageprefix,$available_languages) && (($qvalue*0.9) > $bestqval)) {
                $bestlang = $languageprefix;
                $bestqval = $qvalue*0.9;
        return $bestlang;

    Plugin Author AHWEBDEV


    Thank you very much,

    I really prefer let the user set the languages in administration.

    You can now define locale in plugin settings.
    if empty Default is equal to WPLANG, else if WPLANG is empty,
    plugin will use en_US.

    Because, if a user choose to use facebook in spannish in facebook account, the sdk facebook will do the rest.

    You use to go on facebook from a lot of differents browsers and never with the same language.

    Try the new version 0.9.6!

    I see your point. Mine was only an advice for an additional option (nothing forced by the plugin itself).

    My WPLANG is already set to it_IT, but since facebook doesn’t seem to automatically get user’s preferred language (unless now it does with the new plugin version I still have to try it), I was thinking my suggestion as a workaround.

    By the way, thank you for the update!

    Plugin Author AHWEBDEV


    Yep, I unserstood the need…

    I will see that later, if someone are asked for same feature.

    You can Set your languages with hook if you want.

    Just add filter like that

    function mycustom_function($options){
       $options['locale'] = 'it_IT';//or prefered_languages();
    //filter hook for all options

    (set priority to 10 but maybe should change it.)
    This filter is call at the end of init.php

    Actually, the filter it’s enough: thanks!

    I just installed this plugin, but the like-button is still showing in English, though I have nl_NL in ‘locale’ under ‘settings’ (version 0.9.8). My WordPress install is also in nl_NL.

    When I edit a post, I get these custom fields on my post-page. How can I get rid of them?

    awd_fcbk_option_ogtags_title: etc.

    so I see this information on the website… strange?

    Plugin Author AHWEBDEV


    For your first question,

    You should use xfbml instead of iframe to let facebook detect your lang.

    For the second quesiton:

    I have to modify the plugin to use the custom field with an underscore above the key.
    _awd_fcbk_option_ogtags_title instead of awd_fcbk_option_ogtags_title.
    To hide them in the post editor.

    This will be done in 0.9.9

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Facebook AWD All in one] Like button is not localized’ is closed to new replies.