In this lesson, you are creating a properties
file that contains the text for the warranty term column for Management
Center. 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
- Create a properties file to include the warranty text to
display in Management Center and in your store:
- In the Enterprise Explorer view,
go to
- Right-click Java Resources: src,
click .
- In the Name field, enter com.mycompany.commerce.catalog.client.lobtools.properties.
- Click Finish. The new package com.mycompany.commerce.catalog.client.lobtools.properties is
created.
- Right-click the com.mycompany.commerce.catalog.client.lobtools.properties package
and click and
click Next.
- In the File name field, enter CatalogLOB_en_US.properties,
click Finish. The CatalogLOB_en_US.properties file
opens.
- Define the properties for the warranty text to display:
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
Note: WarrantyTerm
is used in this lesson. The other properties are used in subsequent
tutorial lessons.
- Create a duplicate of CatalogLOB_en_US.properties and
name it CatalogLOB.properties.
- Register the new property file in the resource bundle:
- In the Enterprise Explorer view,
go to .
- Right-click lzx and select .
- In the Folder name field, enter mycompany and
click Finish.
- Right-click mycompany and select .
- In the Folder name field, enter catalog and
click Finish.
- Right-click catalog and select .
- In the File name field, enter extCatalogManagementResourceBundle.lzx.
- Click Finish. The extCatalogManagementResourceBundle.lzx file
opens.
- Add the following code to the file:
<library>
<class name="extCatalogResourceBundle" extends="wcfResourceBundle" baseName="com.mycompany.commerce.catalog.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 id="extCatalogResources"/>
</library>
Use of the extCatalogResources
id
is referenced in the Management Center definition files on the next
page of this tutorial.
- Save and close the file.
- Include the extCatalogManagementResourceBundle.lzx file
so that it is available to use.
- In the Enterprise Explorer view,
go to .
- Open the CatalogExtensionsLibrary.lzx file.
- Update the file to include the following code to point
to the customized resource bundle file:
<library>
<!-- File to add customer libraries -->
<include href="../../mycompany/catalog/extCatalogManagementResourceBundle.lzx"/>
</library>
- Click Save.
- Right-click LOBTools Project;
then click Build OpenLaszlo Project to produce
an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory.
This directory is the default environment setting.