Alternate profile language in LinkedIn API not working - linkedin-api

According to the LinkedIn API docs, the user's profile can be retrieved in multiple languages. This is done by adding a Accept-Language header on the request. I provided a Korean translation to my profile and included the header but the response is still in English.

Your header value does have the wrong syntax. It should be ko-KR instead of ko_KR.
Also double-check that the second part is correct. For example, en-GB will not return a profile in US English, only en-US will. Other variations fall back to the default language which might not be English at all.

Related

Facebook like/share for multilingual page

I have three pages with the same content, in different languages.
http://example.com/en/elephant
http://example.com/nl/elephant
http://example.com/de/elephant
When someone presses the share/like button on the dutch (nl) version I expect that the like is being shared with the english and german version.
I have set the og:url to the english version (I guess I do have to pick a version).
But the problem I now have is that the Facebook scraper looks at the english version for meta tags. So people see an English title/description when they share the dutch version.
According to the the Facebook documentation I can take a look at the X-Facebook-Locale header to serve the meta tags in the right language. But than I should serve an English page with Dutch meta tags to the Facebook crawler.
Not only is this taunting my OCD, but it also makes the code more complicated. Because the meta tags are set at different points in the request pipeline, I have multiple places where I have to switch between Cultures.
Another approach I was thinking about, is to see if there is an X-Facebook-Locale header and then do a redirect to the appropriate language, but for some strange reason that also doesn't seem to work.
What to do?
If the Facebook crawler comes to you with a X-Facebook-Locale header, then you should indeed pass it the localized OG tags. But be sure to keep one common URL.
How we (will) solve this on our site:
http://example.com/elephant is a "neutral" URL, and redirects to the /en, /nl or /de version based on the user session, or browser language preferences.
All language-specific URLs have this neutral URL in their og:url. This is the object that gets saved in the graph.
If Facebook comes to us with a X-Facebook-Locale header, we serve the same content (whether it is at /en, /nl or /de), but with the relevant tags localized.

Facebook Graph API locale parameter broken?

This API URL gives me the front page of VitaminWater's Facebook page (http://www.facebook.com/vitaminwater):
https://graph.facebook.com/50540568485?fields=id,name,link,picture,posts.fields(message,picture,link,likes)&access_token=...
They have a good deal of content targeted at people in Germany, but no matter what I do, I can't get the API to return it - it always gives me English content. I've tried setting the parameter "locale=de_DE" per Facebook's API reference documentation, as well as passing headers such as "Accept-Language: de" and "Accept-Language: de-DE" None of this works. Is this just broken, or is there some other way to retrieve the content for a specific locale I should be using?
I have no solution but I can confirm that something in API is broken. We are working with monitoring tools from different providers and since March 13 this problem persists and hasn't been solved. Posts from personal and fanpages appearing only randomly in German language.
From an information by one of the tool providers I have learned that they are working together with FB to identify and fix the problem. So maybee it is frustrating to wait but this might be the better approach.

How to retrieve page with special characters in page name

Trying to retrieve general page info using the Facebook graph API using an Jquery/Ajax call. This works flawlessly until I request a page containing special characters or dashes in it's name.
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found. I can't find a way though to obviate this.
Example url: https://graph.facebook.com/Musée-de-la-Photographie-Charleroi?access_token=[my_access_token]
Can anybody help me out?
I think you should test different values in contentType parameter. It allows to set char encoding.
Take a look here:
http://api.jquery.com/jQuery.ajax/
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found.
No, I don’t think that’s the problem.
As you can see from https://developers.facebook.com/tools/explorer?method=GET&path=18521449287, this page does not have a username set yet – and since it is not accessible via just www.facebook.com/Musée-de-la-Photographie-Charleroi, but only via www.facebook.com/pages/Musée-de-la-Photographie-Charleroi/18521449287 including the page id.
And accordingly, info about the page on the Graph API is only available via the page id as well.
Try using the page_id instead (in this case 131141113604635).
https://graph.facebook.com/131141113604635?access_token=[my_access_token]
You may get this id by opening the page on the browser and pressing Ctrl+U, Ctrl+F and searching for a 'page_id' value.

Facebook API: What language are the locations returned in?

I searched Facebook's documentation, but could find it. In what language are the locations (for example, for checkins) returned in the Facebook API? In the application's language, in the current user's language, in the original language or in the local language?
How can I be sure that the locations are always returned in, lets say, English?
So Roma is returned as Rome, Praha as Prague and so on.
I don't think this is possible:
Editing a Place page on facebook.com doesn't present any internationalisation options
The Translations app seems geared towards translating Facebook's static content from English into other languages, rather than translating user-generated content into arbitrary languages
The only column of the FQL place table which is affected by the request locale parameter is display_subtext (example)
The only attribute of the Graph API user/checkins connection affected by the request locale parameter is application.name (example)
I think you're limited to whatever language(s) the Place creator/editors have used.

Facebook Share problem for Non English Urls

We have an arabic website and we are trying to share a Url on face book. The Url looks like
http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
The problem is that the facebook does not get thumbnails present on the above link.
When we debugged this through fiddler, we found that the url that facebook is trying to access is not the same as given above, this url is like
www.website.com/ar/%c3%98%c2%b4%c3%98%c2%a7%c3%99%e2%80%a1%c3%98%c2%af%c3%99%e2%80%b0-%c3%98%c2%b9%c3%98%c2%b1%c3%99%cb%86%c3%98%c2%b6-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%a3%c3%98%c2%b2%c3%99%c5%a0%c3%98%c2%a7%c3%98%c2%a1-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%b9%c3%98%c2%a7%c3%99%e2%80%9e%c3%99%e2%80%a6%c3%99%c5%a0%c3%98%c2%a9-%c3%98%c2%a8%c3%98%c2%b9%c3%99%c5%a0%c3%99%cb%86%c3%99%e2%80%a0-%c3%98%c2%b9%c3%98%c2%b1%c3%98%c2%a8%c3%99%c5%a0%c3%98%c2%a9/%c3%99%e2%80%a6%c3%99%cb%86%c3%98%c2%b6%c3%98%c2%a9/story/75
I need to know what facebook did to the url that it became as shown.
One more thing that i know is that this url is not UTF8 encoded. If the given arabic url is converted to UTF8 then it looks like following and not as above
www.website.com/ar/%D8%B4%D8%A7%D9%87%D8%AF%D9%89-%D8%B9%D8%B1%D9%88%D8%B6-%D8%A7%D9%84%D8%A3%D8%B2%D9%8A%D8%A7%D8%A1-%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85%D9%8A%D8%A9-%D8%A8%D8%B9%D9%8A%D9%88%D9%86-%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/%D9%85%D9%88%D8%B6%D8%A9/story/75
So i need to know which encoding the face book is using or what facebook is doing to access the following url when we share the url
www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
That's not a URI (or URL). It's an IRI. Unfortunately a lot of software doesn't support IRI directly (including SO, as you can see from the way it has linked only the first part of the address!).
So if you want the link to work everywhere you'll have to write it up as a plain URI with UTF-8-URL-encoded pathnames, as in the last example (%D8%B4...). Browser will usually present the encoded link in the address bar as a nice IRI regardless of the link in the HTML document being plain URI.
%c3%98%c2%b4... is what you get when you take bytes that are UTF-8 encoded and treat them as if they were ISO-8859-1-encoded (and then UTF-8-URL-encoding them again, giving a broken “double UTF-8”). How are you getting the IRI into Facebook? Either there's an interface you're using that you're sending UTF-8 but which expects ISO-8859-1, or it's just a plain old bug on Facebook's part. Either way, you'll have to use the URI version for now.