Translating Platform Applications

From Facebook Developer Wiki

Jump to: navigation, search

If you're a developer who's built applications on Facebook Platform, you can now access Facebook’s Translations application to make your applications translatable. This will enable members of the Facebook community who use your applications to translate them into their native languages, and for your users to enjoy your applications in their native languages.

We've customized the Translations application for developers to enable you to manage the translation process for your applications. Any developer can have access to this through the Translations application. You can utilize all features of the Translations technology, including in-line translation and community voting/discussion.

Contents

[edit] Community Translation

The Facebook translation process is a community effort. Only Facebook users of an application can translate the application.

You can edit and approve any translation of your application. You do this in the <appID> Admin Panel of the Facebook Translations application. Once you approve a translation, it may take up to 24 hours before that translation is reflected to the users from that locale, and only if they're browsing Facebook in that language.

You can also appoint others to edit and approve translations of your application. In the Admin Panel of the Translations application for each language, click Manage and enter the name(s) of the people you want to have approve translations.

More information is available in the online help in the Translations application.

[edit] Preparing Your Applications for Translation

Preparing an application for translation involves a number of steps:

  • Choosing the languages in which your application will be available for translation
  • Considering which application integration points need to be translated
  • Marking up your application's strings appropriately so your application can be translated

[edit] Choosing the Languages for Your Application

You can specify the language(s) in which your application will be available for translation in the <appID> Admin Panel of the Facebook Translations application. You can select any languages that are currently publicly released on Facebook. You can get a sense for which languages you need to translate your application into by determining how many people in a given locale use your application. You can determine a user's locale from the fb_sig_locale parameter we pass along with application data from your user. This parameter indicates the locale in which the user has selected to browse Facebook. You can determine a user's locale by querying the user FQL table or the locale field in the users.getInfo API call.

At this time, you can make translatable only applications that are in English originally (that is, in the Facebook Developer application, the Language Selection field is set to English). Facebook may offer the ability to translate applications that are written in other languages.

[edit] Considering which Parts of an Application You Want Translated

Good social applications on Facebook are designed to allow users to share information with each other. At this time, we aren't considering translating user-generated content. But we designed our Translations framework so that static, non-user-generated text in applications can be translated easily and displayed on Facebook in any locale in which we have published. The following parts of your application can be made available for translation:

1. Static text that you register on Facebook.com.
This category contains information such as the application description, About page description, and the attachment action registered on your Edit Settings page of the Developer application. If you wrap these with fb:intl tags as you would your normal FBML, then Facebook automatically populates these fields in the Translations application so they're ready to be translated without any additional effort on your part. However, keep in mind that every time you change these fields, you will lose the previous values that you had registered (including translations), and they will have to be retranslated- during which time they will only be available in the base language in which they are written. Keep this in mind, especially once your application is fully translated.
2. The text that is a part of your FBML.
This comprises the vast majority of text associated with most FBML-based applications. In order to make the text in your FBML translatable, we've developed a number of new FBML tags. For more information, see below.
3. Notifications.
The text that can be made translatable is the content sent by the notifications.send API call.
Note: We are determining the best strategy for efficient internationalization of this text. The current manner of having them translated is to register the text of the notifications you plan to send (through the batch API or in the FBML of one of your pages), and then making sure that the FBML sent for your notifications is exactly the same. If this is the case, then it will be translated for you.
4. Requests.
The text for these all comes from the text for request-option button text, or the content attribute for the request-form, which will appear on the user's request page.
Note: We are determining the best strategy for efficient internationalization of this text, but at this time, our recommendation is to follow the method mentioned in 'Notifications' above.
5. Text contained within images.
Many logos and other images in your application may include text, and there is no simple way to make it translatable. If your application has such images, we suggest you try to extract out as much text as possible. Images for which this cannot be done must be localized by the developer and not the community. This would involve creating an image with translated text for each locale you want, and using that image for users browsing in that locale (remember you can determine a user's locale by the fb_sig_locale parameter we pass). Facebook is not involved in the translation of text in these situations.
6. Text in Feed stories.
With the introduction of template bundles with the new profile design, Feed story text can be translated in a similar manner to static text in point 1, as it gets registered with Facebook directly, offline and prior to use. In this case, all registered templates will be automatically entered into the Translations application on behalf of your application, where they can then be translated. Keep in mind that each template you register will be exploded into several strings in the Translations application, since the actor and targets have the potential to vary based on gender and number.
In order to assure that a Feed story gets translated, verify that the template bundle text has been translated into the proper locale prior to sending stories with that bundle. And to plan for the best possible translations of your text, make sure your templates follow the guidelines set forth in the best practices.

Note: We do not currently support translation of your application's name.

[edit] Marking up Your Application's Text

To ensure that the text in your application that is formatted for FBML gets translated properly, you need to tag all the content visible to users with special FBML tags. These tags include:

  • fb:intl -- The principal tag for making a string of text translatable.
  • fb:intl-token -- Replaces a token contained within fb:intl with its content.
  • fb:tag -- Renders an HTML tag.
  • fb:tag-attribute -- Contains the value of an HTML attribute specified by fb:tag that needs to be translatable.
  • fb:tag-body -- Contains the contents of an HTML tag specified by fb:tag.
  • fb:date -- Renders a date, adjusting the format correctly depending on the locale settings of the viewing user.
  • fb:fbml-attribute -- Contains the value of an attribute of an FBML tag, allowing the value to be translated.

For example you have the following FBML in your application :

Give <fb:name uid="4800348" useyou="false"/> a copy of "Catcher In the Rye"?

When Facebook renders the FBML, this would yield a proper English sentence. However, in order to render it in a way that is translatable, this line must be converted to something like the following:

<fb:intl desc="Asking whether user wants to give a book to someone"> Give <fb:name uid="4800348" useyou="false"/> a copy of "{book-title}"? <fb:intl-token name="book-title"> Catcher In the Rye </fb:intl-token> </fb:intl>

Note a few things. First, the line itself is now wrapped at the outermost level by an fb:intl tag. This has one optional attribute called desc, which is the description of the text that will be provided to the Translations application. It's important that the description is informative enough and specific enough to allow for translations in each of the published languages. We have a number of best practices to avoid common pitfalls when formatting this information.

Second, we have extracted out the variable text (the book title) as a token set off in curly brackets, since we don't want the actual book title to be part of the translatable text. This string, including the token, is what translators will need to be able to translate, using only the description as context.

Third, since we need to decide the variable text to place into the string at render time, we have one final new FBML tag, fb:intl-token. This tag has one required attribute name, which must be the string in the token(s) it is meant to replace. Note that while in general these components can be ordered in any way, we suggest something similar to the above, for the sake of readability and to prevent forgetting tokens.

Finally, the translatable message still contains the fb:name tag. This tag will show up as another token when the string is presented to translators, but the token is inserted by Facebook's translation system; you do not need to put it inside curly braces manually. The translator will be presented with the string, "Give {name} a copy of "{book-title}"?" in this case.

When your FBML text is wrapped like this, it will be uploaded to the Translations application on the first canvas page load containing this FBML. After that initial page load, it will be translatable both in the Translations application as well as inline by people who have installed the Translations application. Once the text is translated in, say, Spanish (and you specifically chose to publish your application in Spanish), it will appear to users browsing in the Spanish locale. Note that it may take up to 24 hours between the the time when a user finishes translating a string until the time when the translation appears on the site to users.

Much of this should make better sense after you read the best practices for advice on how to best prepare your applications. We strongly encourage you to do so.

[edit] Reviewing the Status of Your Translations

You can review the status of the translation of your application, then choose when to launch or publish your application into the application directory. In the Developer application, go to My Applications, then select Translations from the more menu.

You can also retrieve (and store, as needed) the native strings and their translations by calling intl.getTranslations.

[edit] More Resources

For more information on using the Translations application, read the Translations help file.

We updated our sample application, Smiley, to make it translatable. You can download and review it.

reference