concept locale in category seam

This is an excerpt from Manning's book Seam in Action.
When an application needs to output a message, the proper approach is to have it use a message key rather than use a hard-coded message string. The application then looks up a value for that message key in the active resource bundle for the current user at runtime. Typically, the keys are used to select locale-specific message strings. Examples include labels, date and time patterns, and currency units. Resource bundles also have applications that extend beyond locale, such as theme parameters and deployment environment settings.
In Java, a regional language is known as a locale. Locale selection has long been a standard part of the communication between the browser and the Java Servlet API, and is equally well supported in JSF. The negotiation works as follows. The browser sends a header named Accept-Language as part of the request, itemizing the languages understood by the user, weighted by preference. The server then sets the preferred locale accordingly, falling back to the server’s default locale if the Accept-Language header is empty or absent.
Granted, the user’s preferred locale setting doesn’t do much good if the application doesn’t support it. Thus, JSF goes a step further by comparing the user’s preferred languages against a list of locales the application claims to support and selecting the best possible match. If there are no matches, the server’s default locale is chosen. While Seam aggregates the i18n resource bundles in your application, it relies on JSF to handle the negotiation of the user’s locale.
If you want to make the locale setting permanent, you can persist it to the database in a user preferences table. You then use the localeSelector in the authentication routine to transfer that setting to the user’s session:
@In LocaleSelector localeSelector; localeSelector.setLocaleString(userPreferences.getLocale()); localeSelector.select();When the user changes the locale, Seam raises the org.jboss.seam.localeSelected event. You can observe this event to persist the selection back to the database: