Hi,
I've watched the impressive presentation by Rahul Doshi.
Yet, looking at the ... well ... clumsy way of pluralization and gender
dependant strings I'd like to suggest an alternative:
*Here's the suggestion:*
Have the JSON localization string files not just contain a string per key
but an object of strings:
{
myMessage: {n: ['No one applied for it.', 'One person applied for it.',
'%number
persons applied for it.'] // gender agnostic (neuter) [0, 1, other]
m: ['No man applied for it.', 'One man applied for it.', '%number men
applied for it.'] // male [0, 1, other]
f: ['No woman applied for it.', 'One woman applied for it.', '%number
women applied for it.'] // female [0, 1, other]
}
}
With default logic applied for simple texts:
{
myMessage: 'This string fits all cases.'
}
Gender agnostic:
{
myMessage: ['Nothing to declare.', 'One piece to declare', '%number pieces
to declare.']
}
Quantity agnostic:
{
myMessage: {n: 'It\'s a child.',
m: 'He\'s a man',
f: 'She\'s a woman'
}
}
And mixtures of it:
{
myMessage: {n: 'The police came.',
m: ['No police men came.', 'One police man came.', '%number police men
came.']
f: 'Female cops arrived.'
}
}
Don't you think this might help keeping things clear?
I believe this will be much more concise than the "data-count"/"data-when"
approach.
And this way of setting messages also would support different layouts for
different languages.
Regards,
Axel Dahmen
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.