Topic-icon Suggestion to internationalization

Active Subscriptions:

None
JFBConnect is great... I am more and more happy with it!

Now... a suggestion to help multi-language sites...

On system plugin "jfbcsystem" (jfbcsystem.php) you have on private function _getJavascript($appId, $fbLocale) (around line 50):
$locale = $lang->getDefault();
$locale = str_replace("-", "_", $locale);

This was causing all FB Javascript to work in en_GB (my Joomla default language, and NOT my Joomla current language)

So I took the liberty of.... errr... improving (not messing up, I hope) your code, and changed it to
$locale = $lang->getLocale();
$locale = str_replace("-", "_", $locale[2]);

Is this the right way to do it?
If so... will you consider including this change in future releases?
If not, could you correct me and include a solution in future realases?

Thanks!
The topic has been locked.
Support Specialist
12 years 9 months ago #11154 by alzander
Alexandre,
I'm assuming you mean that it's not picking up the language set by the Joomla user? If so, I believe you're correct that we aren't doing it correctly (just getting the default of the site as a whole). I don't know immediately if your answer is the perfect solution, but if it works for you, great. I've added it to our tracker to investigate further for our next major release in July, and I can see this change (or something similar) being added then.

If I'm missing what you're saying, just let me know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
Yep... that's it!

My site is on both English and Portuguese, and the user is able to choose his/hers language of preference. Your original code is always getting the default Joomla Language, not the currently selected language.

My main question is: is the only place I must change the code... or are there other parts of your code that deal with the language issue?

It's great news you are considering this for the next release!
The topic has been locked.
Support Specialist
12 years 9 months ago #11206 by alzander
Alexandre,
Yes, that should be the only place. Everywhere else, we should be using Joomla to load the appropriate language file, and it will do it automatically based on the current user's language (falling back to the default if none is selected). The location you found is the only place that we load the Facebook Javascript library, which is what translates all of the Facebook widgets (Like, Comments, etc). There isn't anywhere else that should have this issue.

I'm assuming you're solution worked? If so, we'd love to know cause it will help us make sure we're implementing the right thing. It's already logged as an issue to be fixed in the next release, and I don't see any reason why we'd push it back.

Thanks again for you feedback,
Alex
The topic has been locked.
Support Specialist
12 years 9 months ago #11585 by alzander
Alexandre,
I wanted to follow up on this post since we just implemented the solution to this problem for our upcoming release. It's a little different than your change, so wanted to call it out. Instead of using getLocale, we are using getTag. The locales returns an array of many different locales, like de_DE.UTF8, de_DE_CH.UTF8, etc. In order to use these values, you'd need to strip the .UTF8 part. Additionally, depending on the ordering of the locales, the best one might not be in the first spot of the array.

So, to fix for the upcoming release, we're doing the following, which only returns the most common locale for the language (de_DE, for example):
$locale = $lang->getTag();
$locale = str_replace("-", "_", $locale);

Feel free to try that solution and see if it works for you. We'd love to hear your feedback.
The topic has been locked.
Active Subscriptions:

None
So far so good... seems to be working fine and it is a much more elegant solution.
The topic has been locked.
Support Specialist
12 years 9 months ago #11592 by alzander
Glad to hear it. We got another report from a user with a similar, but slightly different language issue, that it was working for them too. Additionally, they are using JoomFish, wish means it's compatible with that too.

So, for now, we're marking this as closed in our bug-tracker and, again, will be including in the next version as well.

Thanks for the feedback!
The topic has been locked.