More internationalization
The error messages that you define for the business rules in your entity objects should also point to a string in a resource bundle instead of containing hard-wired error or warning messages.
If you have data in several languages in your tables and want to present, for example, a list of values in a user language, you need a managed bean and a bind variable in your view object. The managed bean has access to the browser session variables and can retrieve the UI language and store it in a variable. The view object can then use a bind variable assigned with a value using the built-in adf.context
object to refer to the bean value. Therefore, if you have a LocaleHelperBean
class with a Session
scope and a userLanguage
parameter, you would assign your bind variable to the adf.context.sessionScope.LocaleHelperBean.userLanguage
expression.
You will notice that the standard texts that ADF supplies (for example, Sort Ascending, when pointing to a table column header) will also be localized. ADF comes in all of the languages to which Oracle normally localizes their end user software—several dozen at the last count. As we discussed in Chapter 8, Changing the Appearance, these strings are a part of the skin; if you are not happy with Oracle's standard texts in a language, you can create a skin that overrides them with your own texts.
It is also possible to change the language programmatically. However, it's a bit of an advanced topic and falls outside the scope of this book as it involves creating and registering a phase listener to ensure that the chosen language is always set before the page is rendered.