angular-localization
angular-localization copied to clipboard
[FR] Separate plural and gender messages from html markup
Wondering if it's possible to move whole pluralize staff from HTML markup to substituted strings?
The main con of the following example that developer has to know all plural cases in advance for all languages. Adding new language require html update and makes it dirty as adds more language specific cases.
<span
data-ng-pluralize
data-count=“pluralization.numCount"
data-when=“{
'0': '{{ pluralization.options.zero | i18n }}’,
'1': '{{ pluralization.options.one | i18n }}’,
'2': '{{ pluralization.options.two | i18n }}’,
‘3': '{{ pluralization.options.three | i18n }}’,
'other': '{{ pluralization.options.many | i18n }}' }”>
</span>
It would be better to simplify HTML to specify message key and optional gender/plural attributes and leave message format for a translator:
<span
data-ng-i18n="message.key"
data-gender=“gender"
data-count=“numCount">
</span>
Message itself should be able to case between genders (when necessary) and plural options specific for particular language.
Inspired by http://userguide.icu-project.org/formatparse/messages