# Setting up a component for localization

This topic describes the steps needed to develop or update a component so that it supports localization.

To set up a portlet for localization:

1. Update the portlet.xml file to specify the locales this portlet will support. The following example enables English and German:

       <supported-locale>en</supported-locale>
       <supported-locale>de</supported-locale>

2. Update portlet.xml to specify the location of the portlet's resource bundle. (The resource bundle is the mechanism the Liferay Portal uses to add localized content to a portlet.) Continuing our example, we will include resource files Resource_en.properties and Resource_de.properties in the sample portlet's com/endeca/portlet/sample/ directory:

       <resource-bundle>com.endeca.portlet.sample.Resource</resource-bundle>

3. Create resource bundles for your supported languages in WEB-INF/src/[path/to/resource/bundle]_[locale].properties (for example, the bundle for English for an Endeca component would be WEB-INF/src/com/endeca/portlet/sample/Resource_en.properties). For the most part, this is a simple properties file with key/value pairs for message IDs and their locale-specific messages.
4. Update your portlet's implementation to use the LanguageUtils class to retrieve messages from the resource bundle, rather than hard-coding message strings. This should be done for all messages displayed to the user, including form labels, portlet titles (and other metadata), warning and error messages, preferences pages, help text, and so on. See below for details on how to use the LanguageUtils class.

Note: See the sections below for details about portlet-specific messages and messages with tokens.
Note: You may note that the resource-bundle attribute is different from the file path you edit messages in. This is because the portlet build process combines common message strings from shared libraries with your portlet-specific messages to create the final com/endeca/Resource_[locale].properties file in the compiled portlet WAR. For more information, see the topic below on build process interaction with localization.