In this thread over in the OTN discussion forum, Jack found a small problem with my Example #95 that illustrates how let the end-user toggle the ADF/JSF UI language on the fly. He reported that he'd tried to localize the message text for an ADF list binding so that null entry in the list would show up like "<Any Selection>" in the dropdown. However, after toggling the language the null entry re-rendered in the previous language until a second, subsequent request.
This was a subtle problem related to the fact that the ADF List Binding prepares its list of valid choices (including the automatically-added "null" entry with translatable label) during the prepareModel phase of the lifecycle, and typically avoids recalculating the list during the prepareRender phase. But if we change the preferred locale between the prepareModel and the prepareRender phases, we need to force the list bindings with translatable null strings to recalculate their list of valid values.
I've updated my example #95 to accommodate having this work correctly. This required changing the implementation from using a JSF View Handler to performing that work in a custom FacesPageLifecycle class in an overridden prepareRender() method instead. Please re-download the example zip to experiment with the improved implementation.
And thanks to Jack for finding this little issue!
12:35:33 PM
|