Translation parameters in angular‑gettext
As a general rule, I try not to include new features in angular-gettext: small is beautiful and for the most part I consider the project as finished. However, Ernest Nowacki just contributed one feature that was too good to leave out: translation parameters.
To understand what translation parameters are, consider the following piece of HTML:
<span translate>Last modified: {{post.modificationDate | date:'yyyy-MM-dd HH:mm'}} by {{post.author}}.</span>
The resulting string that needs to be handled by your translators is both ugly and hard to use:
msgid "Last modified: {{post.modificationDate | date:'yyyy-MM-dd HH:mm'}} by {{post.author}}."
With translation parameters you can add local aliases:
<span translate
translate-params-date="post.modificationDate | date:'yyyy-MM-dd HH:mm'"
translate-params-author="post.author">
Last modified: {{date}} by {{author}}.
</span>
With this, translators only see the following:
msgid "Last modified: {{date}} by {{author}}."
Simply beautiful.
You’ll need angular-gettext v2.3.0 or newer to use this feature.
More information in the documentation: https://angular-gettext.rocketeer.be/dev-guide/translate-params/.
Related
- Custom attributes in angular‑gettext (August 14, 2015)
- Release notes: May 2014 (June 1, 2014)
- Release Notes: Apr 2014 (May 1, 2014)
- Release Notes: Mar 2014 (April 1, 2014)
- Testing with Angular.JS (March 10, 2014)