This change allows to add internationalized messages into CSS. The new
parameter 'lessMessages' contains the array of message keys that get
set as Less variables.
In Less the variables must enclosed in double quotes (") or single
quotes (') to prevent CSS injection.
Example usage:
Resources:
"class": "ResourceLoaderLessVarFileModule",
"lessMessages": [ "editsection" ],
Message 'editsection':
edit
Less file:
content: '[@{msg-editsection}]';
Generated CSS file:
content: '[edit]';
Also add a type case (object) to ensure that an empty object is
serialized as '{}' and not as '[]'.
Also include Less variables from parent.
Change-Id: I280b52c6745fe8e5755dc5d58c5621a64757d99d
This ResourceLoader module provides a way to ship
messages to CSS variables.
We will need this going forward to deal with flash of
unstyled content in various JavaScript based UIs that
are subject to i18n such as table sorting and
collapsible elements.
To avoid overhead of hitting the database to fetch and
transform localisation messages we make use of the MessageBlobStore
making use of `messages` definition already inside
ResourceLoaderFileModule. Given this resource is only intended
for render blocking styles without JavaScript this should be okay
(although if requested in JavaScript will also ship associated
messages)
Bug: T42812
Change-Id: I2bf12cdc848478889acbe9a7a970e46f8aefa287