Renderer Internationalization
This page is currently a dumping ground for point-form notes on how to use the Renderer's message bundle capabilities to easily support internationalization of interfaces. This page will eventually be massaged into useful documentation on that topic.
messageLocator
option to selfRender()
- a function
- given a key and other args, returns a message:
function(key, args) -> message
args
can be used to format a message string - will be passed tofluid.formatMessage()
- the first param can be an array of keys, in which case you'll get back an array of strings
- NOTE This is only used for a UIMessage!!
fluid.messageLocator()
framework function
- will build the function that can be passed as an option to
selfRender()
- pass it your key/strings mapping object
messageSource
option to selfRender()
- form used in tests: {
type: "data", messages: messageBase
} (wheremessageBase
is the key/strings mapping) - if
type
is "data" and there nourl
field, renderer will build amessageLocator
with themessageBase
usingfluid.messageLocator()
- if
type
is "data" and there is an url, nothing happens yet. Plan is to fetch via AJAX - if
type
is not "data", nothing happens.
fluid.parseJavaProperties(text)
in the Renderer
- will convert a textual representation of a
.properties
file in the classic Java properties file format into an equivalent JSON structure, in case a.properties
happens to be what you already have. - returned structure suitable for passing to
fluid.messageLocator()
to build a message locator for you
Using a UIMessage
- component tree key is
messagekey
, e.g.{ ID: "myKey", messagekey: "errMsg.mandarin" }
- the
messagekey
is passed as the first parameter to themessageLocator
function messagekey
can be an array - not sure what that does?