Closed (fixed)
Project:
Facebook Like Button
Version:
7.x-2.0
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
2 Jul 2012 at 12:18 UTC
Updated:
28 Jul 2012 at 21:01 UTC
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
Comment #1
jerdiggity commentedI 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: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.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 calledsite_nameeee).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_languagesomewhere 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')withvariable_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...
Comment #2
lliss commentedI'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.
Comment #3
lliss commentedComment #4
goye2cz commentedIt 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.
Comment #5
lliss commentedThat's not a supported feature yet.
Comment #6
lliss commentedThis has also been backported to the d6 version.
Comment #7
lliss commented