Custom attributes in angular‑gettext
Kristiyan Kostadinov recently submitted a very neat new feature for angular-gettext, which was just merged: support for custom attributes.
This feature allows you to mark additional attributes for extraction. This is very handy if you’re always adding translations for the same attributes over and over again.
For example, if you’re always doing this:
<input placeholder="{{ 'Input something here' | translate }}">
You can now mark placeholder
as a translatable attribute. You’ll need to define your own directive to do the actual translation (an example is given in the documentation), but it’s now a one-line change in the options to make sure that placeholder
gets recognized and hooked into the whole translation string cycle.
Your markup will then become:
<input placeholder="Input something here">
And it’ll still internationalize nicely. Sweet!
You can get this feature by updating your grunt-angular-gettext
dependency to at least 2.1.3
.
Full usage instructions can be found in the developer guide.
Related
- 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)
- Release Notes: Feb 2014 (March 1, 2014)