Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

It's possible to provide:

  • MessageResolver
  • MessageInterpolator
  • LocaleResolver
  • MessageHandler
  • FormatterFactory
  • Formatter
  • Formatter-Config
Note
titleHint

The message module isn't aware of CDI APIs. Therefore, it's possible to use it outside a CDI container in any Java based application. However, if you directly inject an artifact of the message-module in a CDI bean, a dependent scoped instance will be created by default. That means a custom producer is needed to change the configuration and scope it in the scope of your choice. Otherwise the configuration would just change the dependent instance -> configuration via any kind of startup-listeners won't work.

MessageResolver

A message-resolver is responsible for using creating the message-text based on the message-descriptor (key or inline-text) to creating the equivalent text for it, the current locale (and in some cases the message-payload).
(The supported format e.g. if it's required to escape a key, if inline-text is supported,... depends on the concrete implementation.)
In case of a message-key, the message-resolver has to transform it to the message-text by looking it up in a message source like a resource-bundle. The JSF module of MyFaces CODI will provide a default implementation which uses the configured application message bundle as message source. However, usually it's required to provide an implementation in every project (because the impl. is aware of the message-source).

...

A locale resolver provides the current locallocale. The locale is e.g. used to by a MessageResolver to choose the correct language for the message-text. The JSF module of MyFaces CODI provides a LocaleResolver which uses the locale of the current view(-root) (if a FacesContext is available).

...

Info
titleInfo

Instead of context.config().change() it's also possible to use context.config().use() .
Instead of changing the current context, the current context gets cloned and the new context uses the e.g. a new resolver which is configured via the fluent api.