How do you add support to manage content in multiple languages in a plugin with a custom Element Type? We have a plugin with custom Element Types that allows a user to create a field layout using custom fields.

We understand how to setup a localized site and add translation files.  This question is specifically about how to add support for the user to be able to add content in multiple languages via the custom fields as they add new Entries to a Custom Element Type.

It would be nice to see a list of all the steps we need to consider.  Ideally, the answer could double as the page we would have read in the documentation instead of posting this question =)

Update:

For reference, these are the tables that appear to have a locale column in the default Craft database.


craft_categorygroups_i18n
craft_content
craft_elements_i18n
craft_entrydrafts
craft_entryversions
craft_locales
craft_matrixblocks (ownerLocale)
craft_matrixcontent_body (and any other Matrix field's content table)
craft_routes
craft_searchindex
craft_sections_i18n
craft_templatecaches
It all starts in Your ElementType where you need to return true on the isLocalized function (Line 62 in BaseElementType.php).

Setting this to true will tell Craft that data is stored per-locale, and it's local choices are based on your Element Model's getLocales function. You can get a basic example from Line 231 of BaseElementModel.php.

Craft's Entry Element actually allows you to choose which locale's are used on a per section basis. You can see an Entry gather its locales on Line 54 in EntryModel.php and Line 57 in SectionModel.php. A section stores its locale options in a related table via SectionLocaleRecord.

The rest should be handled by Craft so long as you set localeEnabled to true and locale to a locale ID in your model before passing it along to saveElement.

The rest of the work is templating, which you can reference how P&amp;T do it in templates/entries/_edit.html.