translatePlural and translateContext#150
Conversation
|
I must say, the first reaction to this was "what on earth is this?". But it's growing on me. This is actually a really neat and elegant solution to the fact that filters don't take objects. |
|
Thanks. Personally, I'm still not convinced it's the way to go. I'm kind of throwing stuff up to see what sticks. But I'll keep working on it. |
07ede21 to
57548a2
Compare
|
Done for now. The only reason you need to terminate the filter chain with I still want to take a look at getting around Angular's parser limitations wrt. the object literal syntax. Maybe leverage a custom directive or something. |
57548a2 to
095972b
Compare
095972b to
2bb2992
Compare
|
If the translate filter is only useful for attributes, then what about a directive to add and translate an attribute? Something like: <div translate-attr="{foo: {msgid: '', context: ''}}"></div>or <div translate-attr translate-attr-foo="{msgid: '', context: ''}"></div> |
Strawman.
Replaces #148, #122.
Example:
Caveats:
translateso it can return an actual string primitive.$countinstead of{{$count}}as previously discussed in Add translatePlural filter #122.