Tutorials > Management Center > Add new fields in the Catalogs tool

< Previous | Next >


Extend the resource bundle and properties files

In this lesson, you create a properties file that contains text for the WarrantyTerm column. 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 translated into different languages.


Procedure

  1. Create a properties file:

    1. In the Enterprise Explorer view, navigate to LOBTools > Java Resources: src.

    2. Right-click Java Resources: src, click New > Package.

    3. In the Name field, enter com.mycompany.commerce.client.lobtools.properties.

    4. Click Finish. The new package com/mycompany/catalog/client/lobtools/properties is created.

    5. Right-click the com.mycompany.commerce.client.lobtools.properties package and click New > Other > General > 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 properties used in this tutorial.

      productWarranty_ColumnHeader=WarrantyTerm
      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 Instruction
      productWarranty_OtherPrompt=CareInstruction 
      

      WarrantyTerm is used in this step, the other properties are used in subsequent tutorial steps.

  2. Register the new property file in the resource bundle:

    1. In the Enterprise Explorer view, navigate to LOBTools > WebContent > WEB-INF > src > lzx.

    2. Right-click lzx and select New > Folder.

    3. In the File name field, enter mycompany and click Finish.

    4. Right-click mycompany and select New > Folder.

    5. In the Folder name field, enter catalog and click Finish.

    6. Right-click catalog and select New > File and click Next.

    7. In the File name field, enter extCatalogManagementResourceBundle.lzx.

    8. Click Finish. The extcatalogManagementResourceBundle.lzx file opens.

    9. Add the following code to the file:

      <library>
          <class name="extCatalogResourceBundle" extends="wcfResourceBundle" baseName="com.mycompany.commerce.client.lobtools.properties.CatalogLOB">
              <wcfResourceBundleKey name="productWarranty_ColumnHeader"/>
              <wcfResourceBundleKey name="productWarranty_TabHeader"/>
              <wcfResourceBundleKey name="productWarranty_GroupTitleForWarranty"/>
              <wcfResourceBundleKey name="productWarranty_GroupTitleForOthers"/>
              <wcfResourceBundleKey name="productWarranty_WarrantyTermPrompt"/>
              <wcfResourceBundleKey name="productWarranty_WarrantyTypePrompt"/>
              <wcfResourceBundleKey name="productWarranty_OtherPrompt"/>
              <wcfResourceBundleKey name="productWarranty_DisplayNameForTerm1"/>
              <wcfResourceBundleKey name="productWarranty_DisplayNameForTerm2"/>
              <wcfResourceBundleKey name="productWarranty_DisplayNameForTerm3"/>
              <wcfResourceBundleKey name="productWarranty_DisplayNameForType1"/>
              <wcfResourceBundleKey name="productWarranty_DisplayNameForType2"/>
              
              
          </class>
          <extCatalogResourceBundle />
      </library>
      

    10. Save and close the file.

  3. Include the extCatalogManagementResourceBundle.lzx file so that it is available to use.

    1. In the Enterprise Explorer view, navigate to LOBTools > WebContent > WEB-INF > src > lzx > commerce > catalog.

    2. Open the CatalogExtensionsLibrary.lzx file.

    3. Update the file as following to point to the customized resource bundle file:

      <library> 
      
      <!-- File to add customer libraries -->
      <include href="../../mycompany/catalog/extCatalogManagementResourceBundle.lzx"/>
      </library>
      

    4. Click Save.

    5. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This is the default environment setting.

< Previous | Next >


+

Search Tips   |   Advanced Search