Closed tomoakley closed 6 years ago
Hi @tomoakley. Please learn about the messageformat syntax here: https://messageformat.github.io/guide/ (Hint: it uses single curly braces.)
Unless this is more than a support request, feel free to close this issue, thanks.
@lephyrus thanks for replying. I'm trying to pass variables of count
and type
into the translation string, which I assumed worked the same way as the standard ngx-translate library, using {{ }}
to enclose a variable. Am I wrong? Do I have to define the whole string each time for =0
, one
and other
? The two variables are not affected by the pluralisation, I just need to add an 's' on the end if it's 0 or multiple, but leave the 's' off it's single.
@tomoakley All I can tell you is that the whole string is "interpreted" by messageformat, so you have to use its syntax. Please look at the example in the README of this library, or read the guide I've linked above, or just follow my hint and use single braces around your placeholders.
Closing, because there is no technical issue and the README already provides the necessary guidance.
I'm currently working on a benchmark between ngx-translate and transloco to handle i18n on our libs, I don't say that one lib is better than the other, it's not the topic (and not so simple). Just saying that I didn't have to convert my {{
to {
to get it working with transloco and their message format plugin, I didn't check source code to see how it's achieved though
Hi, I've put the custom compiler into my app.module.ts file, so it looks like this:
I am using the module like this:
maxCount
is a variable of typenumber
andfooterType
is a string.In my translations file I have this:
The text is supposed to read '0 locations', (if nothing was loaded) '1 location' or '10 locations'.
However when reloading my app, I get this error in the console:
Thanks for any help.