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

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.