Closed glen-84 closed 5 years ago
Hi @glen-84,
The plugin we provide does not support build-time since most of the time the transpilation of the message includes variables that we need to resolve, that could happen only during runtime.
example:
{
"message": "Can replace {{value}} and also give parse messageformat: The {gender, select, male {boy won his} female {girl won her} other {person won their}} race - english",
}
<span>{{ t.message | translocoParams: { value: dynamic, gender: user.gender } }}</span>
Therefore it doesn't make sense for our case to support precompilation for message format.
@itayod,
I'm referring to pre-compilation from ICU message to JS function, not to the resulting string.
Example:
greeting: Hello {name}
-> function greeting(name) { return ``Hello ${name}``; }
(the above is just an example, it doesn't look exactly like that)
Hi @glen-84.
I see what you meant here, but unfortunately, we are currently not going to support that soon.
I'm submitting a...
Please clarify whether or not the MessageFormat plug-in supports build-time compilation of messages / reading from pre-compiled messages (functions).
The messageformat documentation recommends using messageformat as a compile-time tool, to avoid having to download the compiler to the client and compile messages at run-time. It also solves a potential CSP issue.
Is there any way to use pre-compiled messages with this library?