Topic-icon How to change language of displayed JFBConnect components

Active Subscriptions:

None
Hi
How to change language of displayed JFBConnect components in my website

Thanks
The topic has been locked.
Support Specialist
6 years 4 months ago #63242 by mel
You can set the locale for Facebook using our setting found in JFBConnect > Configuration > Facebook section. For instance, use fr_FR for France. This will notify Facebook to change the language for social widgets, etc.

Our installation package also provides available languages for our component, modules and plugins. This will translate the strings that we have control over. If the language is installed on your site, you should just have to reinstall JFBConnect to get the language added.

If these two options aren't describing what you're asking for, can you provide more clarification please.

-Melissa
The topic has been locked.
Active Subscriptions:

None
I have website with two language English and Arabic
I need to display Facebook comment for example in Arabic if user use Arabic language

www.5tawzeef.com/index.php/content-category-1/91
www.5tawzeef.com/index.php/en/content-category-1/91

File Attachment:


File Attachment:
The topic has been locked.
Active Subscriptions:

None
Please can you help me
The topic has been locked.
Support Specialist
6 years 3 months ago #63247 by mel
If you leave the locale setting blank in the JFBConnect backend > Configuration > Facebook area, JFBConnect has logic to determine the locale based on the language of the page. Then we use that locale to initialize the Facebook javascript.

In your two examples:

www.5tawzeef.com/index.php/en/content-category-1/91
1. og:locale is set to en_gb
2. We have initialized the JS library to

js.src = "//connect.facebook.net/en_GB/sdk.js"


www.5tawzeef.com/index.php/content-category-1/91
1. og:locale is set to ar_aa
2. We have initialized the JS library to

js.src = "//connect.facebook.net/ar_AA/sdk.js"


For the social widgets, those are the only two ways for our website to configure the language of the comment plugin. Other than that, it's out of our hands for what Facebook renders.

-Melissa
The topic has been locked.
Active Subscriptions:

None
It's blank already
But not work.

File Attachment:
The topic has been locked.
Support Specialist
Facebook describes how to do the set the language for the social widgets on the following page:
developers.facebook.com/docs/internationalization

As Melissa noted above, we are doing exactly what they recommend. However, it seems like Facebook doesn't recognize the ar_AR language code. From the first line in the following file, you'll see it shows en_US:
connect.facebook.net/ar_AA/sdk.js

However, if you change that URL to the below, it properly shows ar_AR:
connect.facebook.net/ar_AR/sdk.js

The reason is discussed on the internationalization page above. You may need to change the setting in the Joomla language manager to ar_AR for your language code or use the Facebook Locale override setting in JFBConnect to force one or the other languages.

I hope that helps explain,
Alex
The topic has been locked.
Support Specialist
Actually, we were just thinking this through further on our end and it's something we can fix. Below is a small code snippet we'd love for you to try out and let us know if it works. If so, we can get it included in a future release.

The edit is to the /components/com_jfbconnect/libraries/provider/facebook.php file.

Around line 220, you should see:
$locale = str_replace("-", "_", $locale);
After that line, please add the following line:
$locale = ($locale == 'ar_AA') ? 'aa_AA' : $locale;
That should detect ar_AA and replace it with aa_AA when loading the Facebook javascript file automatically.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
I made the modification for (/components/com_jfbconnect/libraries/provider/facebook.php )
but still same problem


File Attachment:


File Attachment:
The topic has been locked.
Support Specialist
I apologize. I messed the language codes. Please try the following code:
$locale = ($locale == 'aa_AA') ? 'ar_AR' : $locale;

That should detect aa_AA and update it to ar_AR, which is the proper code that Facebook supports.

Please test and let me know how that goes.

Thanks,
Alex
The topic has been locked.