Internationalization/Register Text
From Facebook Developer Wiki
Contents |
Making Your Website or Application Translatable
Text can come from a lot of places, and it's important that if your application is available in a language that everything is translatable. The following is an exhaustive list of all places that you may find content you need to prepare for the translation process.
- Text that will be rendered within your domain (Facebook Connect websites or IFrame applications only).
- There are markup tags specific to XFBML which can be used for this text.
- Text that will be rendered within your FBML markup (FBML applications only).
- There are markup tags specific to FBML which can be used for this text.
- Text entered on facebook.com
- Text sent through Facebook communication channels (notifications, requests, Feed stories).
- Each of the above channels accepts FBML for the message you're trying to send. In order to have the content be translated, you should first wrap the text using the FBML internationalization markup tags. Then, use the intl.uploadNativeStrings API method if you want to register the text to be translatable by users before actually sending it.
- Text contained within your databases.
- Occasionally, there's text content which simply should not be rendered directly. For instance, if your application were an online store, you might store a list of item names of your inventory. This text is static, so you can submit this as part of your text. However, in order for all of your text to be registered, it's generally a good idea to use the intl.uploadNativeStrings API method to register all variations of the text which include each item from your database.
- Note: This technique should not apply to strings that change frequently, or are user-generated. Each application has a static limit for the number of strings that may be registered at any given time, so it's important to avoid submitting dynamic content for translation.
- Text contained within images or other non-text-based representations.
- This content cannot be translated directly using Facebook Translations. If you want to serve internationalized images, it is your responsibility to generate an image for each language you wish to support, and determine the user's locale (for instance, via the users.getInfo API call) to decide which image to serve them.
Best Practices
There are a lot of assumptions that we may make when working with text in code, which may not always hold true in other languages. To help you prepare your application for most languages and quirks, try reading through this set of best practices.
Examples
We've created some examples for you to start with to get an idea of how to make your own application or site translatable.
- Hello, World!
- This is a simple HTML file that demonstrates how XFBML markup can be used to make a simple string translatable.
- The Run Around, International Edition
- The Run Around was our original Facebook Connect example web site, so it's only appropriate that it goes international as well. This is a more complicated example which touches on several of the more complex aspects of preparing an application for internationalization.
- Smiley, International Edition
- Smiley is our most up-to-date example FBML application for getting started, so it's only appropriate that it goes international as well. This is a more complicated example which touches on a few of the more complex aspects of preparing an FBML application for internationalization.
Next Steps
Once you've registered all the text you want translated, start translating your application!
