Browse Source

added i18n support for ngPluralize

transparently localize ngPluralize directives by translating the value
of the "when"-attribute before ngPluralize compiles it
master
Roman Anasal 10 years ago
parent
commit
2e148b29a7
  1. 12
      app/js/i18n.js

12
app/js/i18n.js

@ -128,6 +128,18 @@ angular.module('myApp.i18n', ['izhukov.utils']) @@ -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…
Cancel
Save