Given a JSON text file like this:
{
MyMessage:
{n: ["Its no-name is: %fullName.", "Its one-name is: %fullName.", "Its
multi-name is: %fullName."]
,m: ["His no-name is: %fullName.", "His one-name is: %fullName.", "His
multi-name is: %fullName."]
,f: ["Her no-name is: %fullName.", "Her one-name is: %fullName.", "Her
multi-name is: %fullName."]
}
MySimpleMessage:
{"Hello World!"}
}
An HTML implementation to display above texts then would look something
like:
<body>
<div>
<p>{{ 'common.MySimpleMessage' | i18n }}</p>
<p data-i18n="common.MySimpleMessage"></p>
<input data-i18n-attr="placeholder: common.MySimpleMessage" />
</div>
<div>
<p>{{ 'common.MyMessage' | i18n: {$gender: 'f', $count: 0, fullName: 'Axel
Dahmen'} }}</p>
<p data-i18n="{$text: common.MyMessage, $gender: 'f', $count: 0, fullName:
'Axel Dahmen'}"></p>
<input data-i18n-attr="placeholder: {$text: common.MyMessage, $gender: 'f',
$count: 0, fullName: 'Axel Dahmen'}" />
</div>
</body>
Parameters prefixed with "$" would be inherent to i18n, whereas all other
parameters would serve as substitution parameter names (like "fullName" in
the above example).
All inherent parameters would be optional. {$gender: 'n', $count: 0} would
be the default values if no parameters would be given.
--
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.