Extending the resource bundle and properties files

In this lesson, you create a properties file that contains the text for the new field in the Catalogs tool.A properties file is a resource bundle that contains translatable text that displays in the user interface. Resource bundles contain locale-specific objects. By using resource bundle files, the text can be easily translated into different languages.

Procedure

  1. Create a properties file to include the warranty text to display in Management Center and in your store:
    1. In the Enterprise Explorer view, expand LOBTools > Java Resources > src
    2. Right-click src and select New > Package.
    3. In the Name field, enter com.mycompany.commerce.catalog.client.lobtools.properties.
    4. Click Finish. The new package com.mycompany.commerce.catalog.client.lobtools.properties is created.
    5. Right-click the com.mycompany.commerce.catalog.client.lobtools.properties package and select New > Other. Expand General. Select File and click Next.
    6. In the File name field, enter CatalogLOB_en_US.properties, click Finish. The CatalogLOB_en_US.properties file opens.
    7. Define the properties for the warranty text to display by copying the following code into your file:
      productWarranty_ColumnHeader=Warranty term
      productWarranty_TabHeader=Warranty
      productWarranty_GroupTitleForWarranty=Warranty Information
      productWarranty_WarrantyTermPrompt=Warranty term
      productWarranty_WarrantyTypePrompt=Warranty type
      productWarranty_DisplayNameForTerm1=30 days
      productWarranty_DisplayNameForTerm2=45 days
      productWarranty_DisplayNameForTerm3=60 days
      productWarranty_DisplayNameForType1=limited
      productWarranty_DisplayNameForType2=comprehensive
      productWarranty_GroupTitleForOthers=Care Instructions
      productWarranty_OtherPrompt=Care instructions 
      Note: WarrantyTerm is used in this lesson. The other properties are used in subsequent tutorial lessons.
    8. Create a duplicate of CatalogLOB_en_US.properties and name it CatalogLOB.properties.
  2. Register the new property file in the resource bundle:
    1. Expand LOBTools > WebContent > WEB-INF > src > xml > mycompany > catalog.
      If the the mycompany directory and subdirectory does not exist, you must create these directories.
    2. Right-click catalog and select New > File.
    3. In the File name field, enter extCatalogManagementResourceBundle.xml.
    4. Click Finish. The extCatalogManagementResourceBundle.xml file opens.
    5. Add the following code to the file:
      
      <Definitions>
        <ResourceBundle baseName="com.mycompany.commerce.catalog.client.lobtools.properties.CatalogLOB" 
         definitionName="cmc/catalog/ExtCatalogResources" singletonDefinition="true"/>
      </Definitions>

      Use of the ExtCatalogResources definition name is referenced in the Management Center definition files in the next lesson.

    6. Save and close the file.