Nova · i18n
Counted phrases
No book can hold “4 left”: the number makes the rows endless. The row is the pattern, {n} left. It is translated whole, so the words may change places, and then its holes are closed. They close in the source language too, so a component is never handed the pattern itself.
{
id: 'i18n-patterns',
data: { left: 4, sold: 16, seats: 20 },
layout: {
component: 'Stack',
children: [
{
component: 'Badge',
props: { label: { phrase: '{n} left', slots: { n: '$.left' } } },
},
{
component: 'Badge',
props: {
label: {
phrase: '{n} of {total}',
slots: { n: '$.sold', total: '$.seats' },
},
},
},
],
},
}{
{n} left: 'noch {n}',
{n} of {total}: '{n} von {total}',
}Nothing. It is only drawn.
{ left: 4, sold: 16, seats: 20 }noch 4 16 von 20
Runs in this page on the installed package. The input and the expected output are defined by the example.