Using Plurals in t Macro #1508
-
I have a requirement to display days based on the numbers and others if the variable doesn't contain the text "day". The div below is for each plan in a given array. I have tried this:
It's getting complex because it has both a ternary operator and plural form, and because the div is inside a map function, I have to put ${index} in the id so that it displays the correct plural form otherwise every plan would just display "days". What I was getting in the json file is:
But if I change After a few more tweaking, I got interesting results. I removed the ${index} in the id, and the translations in other locale work fine. Then the plural form in the default language (en) doesn't work anymore, it would always display "days" for each plan. But it works for another language (e.g. fr) which doesn't even have a given translation. Is there any solution to make both of them work? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That is not going to work. All values, such as id, should be statically analyzable.
Look for the issue in your app code. It's misusage somewhere. |
Beta Was this translation helpful? Give feedback.
That is not going to work. All values, such as id, should be statically analyzable.
planname${index}
is not statically analyzable.Look for the issue in your app code. It's misusage somewhere.