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

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 developed 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.

Related

Facebook app id for website social plugins

I have like/share buttons on my website and am not currently using an appid. Finding information on whether this is a necessity for the above configuration is difficult to confirm. When going through the Facebook app "create" forms, I'm really confused by a lot of the requirements as it seems to be more focused around actual apps rather than websites, which login via fb etc.
In the past I have created an app for one of my other websites and I don't believe there was any verification/submission process at this point (about 2-3 years ago). Reviewing my old app configuration now I can see that it is not "live" - does anyone know whether Facebook implemented this submission process in the last couple of years, and then de-activated any live apps that were created prior to this?
I now want to setup a new app for my new website and I'm unsure what the different 'action types' mean and what I would need to simply use like/share buttons on the website. Could someone give me a quick run down of what I'd need and what they are?
Any other info/tips people can provide would be greatly appreciated. I'm finding that the like/share DO still work without the app, but sometimes the share button doesn't work properly (I have a feeling this is something to do with the app).
Thanks
If you are just using the Social Plugins, you don't need to have a Facebook App ID.
If you want more integration, it will be required. Creating an App ID is like registering your App, wether an iOS or Android App or just a website, so that you can make Graph API calls for it.
The easiest way to register your website is to go the quickstart: https://developers.facebook.com/quickstarts/?platform=web (or https://developers.facebook.com/apps). There you can type a name and follow the steps.
You can then follow the "Sharing best practices" (https://developers.facebook.com/docs/sharing/best-practices#tags) on how to use the App ID. For example, by including an fb:app_id meta tag on your pages.
There is a review process, since last April, but that is only needed if you use permissions for your App. If you just use the plugins, that is not needed.
Can you explain more what is exactly not working?
Update
The time you create a page the Facebook crawler does not know yet what the Opengraph data for that one is. This will happen after the first share, but if you want to ensure it is correct from the first share on, you can force a re-scrape.
This section explains how that works:
https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
When an app triggers a scrape using an API endpoint This Graph API
endpoint is simply a call to:
POST /?id={object-instance-id or object-url}&scrape=true

Custom built On Screen Keyboard in Adobe AIR for oAuth authentication

I am in the process of building a touch screen photobooth where users will take pictures, add graphics, etc in Adobe AIR. At the end of the process, they will get to email themselves the picture, share the picture on Facebook, and share it on Twitter.
I am using this tutorial: http://tv.adobe.com/watch/adc-presents/oauth-in-adobe-air-applications-built-with-flash-or-flex/ to figure out how to get oAuth to work in AIR. But it seems simple. Just load the authorization request URL into AIR's equivalent of an iFrame.
The tricky part is that there will be no physical keyboard on site. For all text input, we designed an onscreen keyboard. Programming an on screen keyboard in AS3 is pretty easy. But we don't have access to the text fields within the AIR HTML/Browser wrapper so we can't manually add characters to the input strings...
Is there any workaround we can implement for this? Adding a physical keyboard is unfortunately out of the question.
I realize this is 5 months old, but I was working on something similar for a client this evening and ran across your question. I also wanted to omit the need for a system level onscreen keyboard, or a physical real world keyboard, just wanted to use a Flash/AIR based keyboard completely under control of the app via the attached touch screen.
I came up with a hacky way to do this all in Flash/AIR and it works for any oAuth dialog (with some caveats). I've got it working as a test for Facebook and Twitter oAuth permission pages just this evening. It requires that you use a StageWebView for the display of the oAuth dialog and some JavaScript injection via loadUrl method of StageWebView. Using the stageWebView, setting up a listener for the Complete event on the load of the oauth permission page in your StageWebView is the first step.
Next step, is once its loaded and the complete event fires, in your complete handler, you can then inject javascript directly into the page via the StageWebView reference, and then via that function set up communication to populate the fields dynamically from your AS3 on screen keyboard or other function. For example, to populate the username field in Twitters oAuth permission page, you could do this:
webView.loadURL("javascript: form = document.forms[0]; form['username_or_email'].value='your_username';");
That populates the username field in Twitters oAuth permission page.
So you could inject a function into the page, which you could then call from ActionScript to pass in key presses from your virtual onscreen keyboard, or completed strings, to populate the proper fields. That is the only tricky part, identifying the form and field names in the source of the oAuth pages ahead of time. So far Twitter and Facebook look pretty straightforward to identify, but of course could break at anytime, a little regexp could help make sure they are correct. Only problem I see here beyond that would be if the field names changes dynamically for security purposes, but from a quick glance at twitter and facebook at least they don't appear to do that. Other oAuth pages may or may not, YMMV.
There is a useful library for working with StageWebView that might be helpful in doing some of this communication - take a look here: http://code.google.com/p/stagewebviewbridge/wiki/Communication
In any case, that is the overall approach, leverage StageWebView, and then dynamically inject your own JavaScript function to handle passing in the value to the fields from your onscreen keyboard, or simply populate the fields directly with code similar to the above. Hope this helps anyone out there attempting something similar.
Wanted to add that I came up with this approach because it was/is a requirement to allow a user to do this directly on the exhibit I am working on, but my personal preference would be to simply collect a users email address, or phone number, and have the interactive send them an email or SMS message to their own device, which they could then easily share more safely and securely. Another solution would be to display a QR code, a user could snap and quickly resolve to share more securely - I prefer those approaches, but the above will do the trick for users willing to enter in their credentials in a public place. Make sure you have time outs on the session and properly logout users credentials for subsequent users, otherwise bad things are guaranteed to occur.

Store data of people who clicked on a button on Facebook

I would really appreciate some help with the Facebook application I currently work on.
I developing a simple Facebook application, and I need to store the data of the people, who click the "I want to win button". I'm not sure if I should use plain, old vanilla PHP, or if the Facebook API provides some simple way to do that, so I would be really glad for some ideas about this.
I read about the topic, but I can't really "see the Matrix" yet, so every answer is appriciated. Also I'm more interested in ideas and not the implementation, as I'm fairly confident in my programming skills.
Thank you everybody!
Richard
You will definitely need to use an external db, coz facebook will not store the data for you. However facebook does store the connection that a user makes with the app, i.e. when a user gives some(even basic) permissions to your app. Hence when an old user comes to your app you can know which, and if it is an old user.
Facebook sends your entry script a signed_request, which contains data about the user visiting your app, this request will have a user_id field only if the user has made the connection/authorized your app, hence you know if it's an old user or new.
Once you have the user_id you can call the graph api to get info about the user. In the php SDK you can easily call $facebookObject->api('/me','GET'); to get user info.
You can easily call the functions anytime, so if you want to make a call when a user clicks your button, you can do that.
Check out the links i have included, thoroughly, you'll get the idea.

How do I translate my application name that is shown on the user profile page or in my application profile page?

How do I translate my application name that is shown on the user profile page or in my application profile page?
I have tried to use the facebook translation service, but it does not work.
The documentation makes it seem like you can translate the name of your application and the translations will show through out Facebook. The translation application has been broken since inception.
Here's a bug that's well over a year old about this issue: http://bugs.developers.facebook.net/show_bug.cgi?id=10501
I have seen some application re-publishing under other names (under different languages) to help capture users who use those languages. I have no idea what Facebook's stance is on that practice, though.

How would I go about creating a Facebook Fan Page tab that contains a Poll?

I'm not sure why but creating any kind of integration beyond the use of social widgets and buttons on external sites always confuses me.
What I need to do is create a tab on a particular Fan Page. This tab needs to:
Contain an interface for casting a vote in a Poll.
Handle multiple Polls. Only one will be featured in the tab at a time, but there should be an interface for navigating to previous polls.
All polling data needs to be stored on my servers - 3rd party Polling solutions (facebook apps, or embedable services) are not an option unless the data storage location is configurable.
All those requirements are pretty easy to address. Im just confused about how to integrate with FB.
Do i need full FB App for this, or is there another way? This will only be accessible via the Fan Page tab, so I don't necessarily need an App at apps.facebook.com.
If it is an app... is there a way to hide the app page, and the standalone app canvas from everyone except Fan Page admins?
FBML will be discountinue very soon. You might need to find an alternative way to do it. :-)
Check out the Static FBML app that Facebook provides. You can implement it on any Facebook fan page, change the tab title, and specify the content in HTML/FBML (with some limitations, I believe IFRAMES, password inputs, and some other random things are not allowed, but don't take my word on these until you test them). Hopefully this at least gives you a little head start.
Even Tradablebits platform is an option. They give a good functionality and make it simpler to work with Facebook. http://apps.tradablebits.com/ I analyzed this platform for one of my apps.