Creating Language Keys

Displaying Messages and Errors

Step 1 of 3

Any modern application should place its messages and form field labels in a language keys file that can be duplicated and then translated into multiple languages. Here, you’ll learn how to provide a default set of English language keys for your application. For more information on language keys and providing automatically translated language keys, see this tutorial.

Language keys are stored in the file included in your guestbook-web module. is the default, but you can create a number of translations by appending the ISO-639 language code to the file name (e.g., for Spanish or for German). For now, stick to the default language keys.

Follow these steps to create your language keys:

  1. Open /src/main/resources/content/ in your guestbook-web module. Remove the default keys in this file.

  2. Paste in the following keys:

    entry-added=Entry added successfully.
    entry-deleted=Entry deleted successfully.
    guestbook-added=Guestbook added successfully.
    guestbook-updated=Guestbook updated successfully.
    guestbook-deleted=Guestbook deleted successfully.
  3. Save the file.

Your messages are now in place, and your application can use them. Next, you’ll add them to your action methods.

« Displaying Messages and ErrorsAdding Failure and Success Messages »
Was this article helpful?
0 out of 0 found this helpful