O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Translations

Problem

I’d like to be able to offer my application in other languages, but I only speak and write English.

Solution

Facebook has made their amazing Translations app available to all developers. When added to your FBML, the following family of tags represents the Translations capability on your pages:

fb:intl

Wrap content you want to make translatable in this tag.

fb:intl-token

Replaces a token contained within an fb:intl tag with its content.

fb:tag

Renders an HTML tag that has translatable attributes.

fb:tag-attribute

Contains the translatable attributes of an HTML tag specified by the enclosing fb:tag tag.

fb:tag-body

Contains the contents of an HTML tag specified by an enclosing fb:tag.

fb:date

Renders a locale-specific date based on the settings of the viewing user.

fb:fbml-attribute

Contains and makes translatable the value of an attribute of an FBML tag.

The Translations app isn’t intended to provide translations for user-generated content within your application (which you hopefully have if you’ve built a good Facebook app), but rather for all of your static text (application description, About Page content, etc.), FBML content, Notifications, requests, and Feed stories.

Using the tags is quite simple and will become second nature as you write new FBML. Assuming you haven’t built a gargantuan app with hundreds of pages, you should be able to go back and retrofit the Translations tags fairly quickly. As an example, consider this FBML:

Share a Pan Galactic Gargle Blaster with <fb:name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required