In this section, we'll create the resource bundle that contains the static text and error messages used by the Facelets pages. The firstcup client supports both English and Spanish locales. Therefore we need to create two properties files, each of which will contain the messages for one of the locales.
Right-click firstcup in the Projects pane.
Select New -> Other from the popup menu.
Select the Other category, then Properties File from the New File dialog and click Next.
In the New Properties File dialog, enter WebMessages in the File Name field.
In the Folder field, enter src/java/firstcup/web as the location of the file.
After NetBeans 6.7 IDE creates the properties file, enter the following messages or copy them from here to the file:
Welcome=Hi. My name is Duke. Let us find out who is older -- You or I. DukeIs=Duke is YearsOldToday=years old today. Instructions=Enter your birthday and click submit. YourBD=Your birthday Pattern=MM/dd/yyyy DateError=Please enter the date in the form MM/dd/yyyy. YouAre=You are Year=year Years=years Older=older than Duke! Younger=younger than Duke! SameAge= the same age as Duke! Submit=Submit Back=Back
These messages will be referenced from the XHTML pages.
Save the file by selecting File -> Save from the menu.
To add the Spanish translations of the messages, copy the properties file WebMessages_es.properties from tut-install/firstcup/example/firstcup/src/java/com/sun/firstcup/web to tut-install/firstcup/myexample/firstcup/src/java/firstcup/web.
You can create multiple properties files, each with a set of messages for a different locale. By storing localized static text and messages in resource bundles, you don't need to create a separate set of XHTML pages for each locale.