Tutorials > Management Center > Add new fields in the Catalogs tool
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
- Create a properties file:
- In the Enterprise Explorer view, navigate to LOBTools > Java Resources: src.
- Right-click Java Resources: src, click New > Package.
- In the Name field, enter com.mycompany.commerce.client.lobtools.properties.
- Click Finish. The new package com/mycompany/catalog/client/lobtools/properties is created.
- Right-click the com.mycompany.commerce.client.lobtools.properties package and click New > Other > General > File and click Next.
- In the File name field, enter CatalogLOB_en_US.properties, click Finish. The CatalogLOB_en_US.properties file opens.
- 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.
- Register the new property file in the resource bundle:
- In the Enterprise Explorer view, navigate to LOBTools > WebContent > WEB-INF > src > lzx.
- Right-click lzx and select New > Folder.
- In the File name field, enter mycompany and click Finish.
- Right-click mycompany and select New > Folder.
- In the Folder name field, enter catalog and click Finish.
- Right-click catalog and select New > File and click Next.
- 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.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>
- Save and close the file.
- Include the extCatalogManagementResourceBundle.lzx file so that it is available to use.
- In the Enterprise Explorer view, navigate to LOBTools > WebContent > WEB-INF > src > lzx > commerce > catalog.
- Open the CatalogExtensionsLibrary.lzx file.
- 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>
- 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 is the default environment setting.