UIViewRoot.getLocale() should never be null; ViewHandler.calculateLocale() should see to that. (Of course, some developer might explicitly call UIViewRoot.setLocale(null), but they'd deserve what they'd get...)
I'd recommend Approach 2 in general. -- Adam On 12/31/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm working in MessageUtils, and noticed that there are two slightly > different approaches to locale processing. My first impulse is to say that > there should be only one approach here. > > First, let the "application" locale be defined as the viewRoot's locale, or > Locale.getDefault() if the viewRoot's locale is null. > > Approach 1 first uses the application locale to find a message. If the > result of that is null, it tries again using Locale.getDefault(). > > This is used for getMessage(FacesContext context, String messageId) and > getMessage(FacesContext context, String messageId, Object params[]) > > Approach 2 just uses the application locale to find a message, and goes no > further. > > This is used for all other getMessage() methods. > > Thoughts?
