added i18n support for ngPluralize
transparently localize ngPluralize directives by translating the value of the "when"-attribute before ngPluralize compiles it
This commit is contained in:
parent
1b8da25224
commit
2e148b29a7
@ -128,6 +128,18 @@ angular.module('myApp.i18n', ['izhukov.utils'])
|
||||
return _;
|
||||
}])
|
||||
|
||||
.directive('ngPluralize', ['_', function(_) {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
priority: 1, // execute before built-in ngPluralize
|
||||
compile: function(element) {
|
||||
var msgid = element.attr('when');
|
||||
var msgstr = _(msgid);
|
||||
element.attr('when', msgstr);
|
||||
}
|
||||
}
|
||||
}])
|
||||
|
||||
.directive('myI18n', ['_', function(_) {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
|
Loading…
Reference in New Issue
Block a user