I was trying to switch the language to Czech "cs_CZ" but Firebug showed me that it was being over-ridden with English "en_US". I went into the module file and found on lines 72, 188, and 204 the following:

'language' => variable_get('fblikebutton_language', 'en_US'),

I'm by no means a programmer but from what I know of css, it seemed to me that the en_US setting would always override the selected language. I switched these three lines to be the following:

'language' => variable_get('en_US', 'fblikebutton_language'),

and it now works as expected.

This is great, but I would prefer it to use the language that the site is currently being viewed in. Any possibility of that coming soon?

Comments

jerdiggity’s picture

Assigned: Unassigned » lliss
Category: bug » task

it seemed to me that the en_US setting would always override the selected language

I totally know what you mean. When I first started with Drupal, this was something I found hard to get used to. :)

However, here's a brief explanation of how variable_get() works:

  • Well, first and foremost, variable_get() requires two arguments: the variable you want to get from the database; and, the value you want to be displayed in case the variable you're searching for doesn't exist.
  • To see it in action, try this (in a development environment, of course):
    1. Log in to your database, and find the variable table.
    2. Browse through the list of variables and pick one that looks "fun". ;) For this example, we'll pretend you chose the variable called site_name.
    3. Log in to your Drupal site.
    4. Create a new Page (or Basic page).
    5. Select PHP Code for the input format of the body of the page.
    6. Type this into the body section:
      print variable_get('site_name', 'Oops! Unable to locate that variable.');
      print '<br/>';
      print variable_get('site_nameeee', 'Oops! Unable to locate that variable.');
      
    7. The result should be the name of your site (the value of the variable site_name), and on a new line, the words Oops! Unable to locate that variable. (because there's probably no variable stored in the database called site_nameeee).
  • I've got to get going, but long story short, since there probably isn't a variable in your database called en_US, I'd imagine if you were to look at the source code for your page with the "like" button on it, you'd see something like &language=fblikebutton_language somewhere inside of it; but since Facebook doesn't know which language is represented by the language code fblikebutton_language, it's simply ignoring this part and falling back to your site's default language (or your browser's default language).

One possible solution would be to replace variable_get('fblikebutton_language', 'en_US') with variable_get('fblikebutton_language', '')... Or maybe this module's newest co-maintainer lliss has other plans in store?? ;)

Anyway, I hope that explanation helped you out a little...

lliss’s picture

I've fixed this in the latest development branch. The issue appears to be that variable was being called back in improperly and the static variable was being used for the dynamic setting. You should be able to switch to the dev branch and your setting should be honored now.

lliss’s picture

Status: Active » Fixed
goye2cz’s picture

Status: Fixed » Needs work

It does indeed heed my setting in the module settings page, but that's the only way I can see to influence the language served to the user.

Maybe I'm misunderstanding, is there no way to let the active site language be the determining factor of which language is served in the module? Example: a user is viewing the site in Czech, the FB Like module serves everything in Czech. A user is viewing the same website in English, the FB Like module serves everything in English.

Very possible I missed something, but I do appreciate what you're doing here. Keep it up.

lliss’s picture

That's not a supported feature yet.

lliss’s picture

This has also been backported to the d6 version.

lliss’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.