开发者

How is a Facebook user's language / internationalization preference stored?

I'm developing a Facebook application for a business page. The application can only be accessed as a tab, meaning there is no box or direct access intended. I've done my share of searching and even though I hate asking for help when I know the information I'm after must be there somewhere, I've reached the point of exhaustion and beg for a solution.

I've managed to work with my application the way it was intended, it retrieves some data from my databases and users can view that information without a problem. The issue here is that I'm unable to figure out a way of getting information from the user who is viewing that tab. I don't want any private stuff, in fact, the only thing I need is to know in which language he/she is viewing FB so I can grab content in that language instead of the default.

I thought that maybe FB stored that information on a cookie, or a session variable, who knows. I'm sure I seen something like en_GB on a cookie from FB once, but maybe it was a mere delusion from sleep deprivation.

I'm sure there is a pretty solution dev开发者_如何学编程eloped already and I just can't wait to learn about it!

Thank you for you time :)


To translate the application, you should be using facebook translations. All the text in your app should be inside and other intl tags and the translation for these should be available on facebook translations app. Then facebook shows the translated text to the user based on their locale.

Facebook Translations app: http://www.facebook.com/translations/ You can see the strings to be translated here.

You also have to enable you applications for translations in the Translation app admin panel. More about translations here : http://wiki.developers.facebook.com/index.php/Internationalization


Here's a method that describes getting the current user's language in a canvas frame even when the user hasn't logged in: http://fbdevwiki.com/wiki/Locales#Getting_the_User.27s_Locale . I suspect that it should also work in a page tab iframe.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜