Skip to content

Commit 6724d53

Browse files
author
ekaterina.pavlenko
committed
Provide scope on every update
1 parent 31a175c commit 6724d53

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

dist/angular-gettext.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,13 @@ angular.module('gettext').directive('translate', ["gettextCatalog", "$parse", "$
497497
$animate.leave(oldContents);
498498
}
499499

500+
var interpolationContext = handleInterpolationContext(scope, attrs, update);
501+
update(interpolationContext);
502+
linking = false;
503+
500504
if (attrs.translateN) {
501505
scope.$watch(attrs.translateN, function () {
502-
update();
506+
update(interpolationContext);
503507
});
504508
}
505509

@@ -510,12 +514,9 @@ angular.module('gettext').directive('translate', ["gettextCatalog", "$parse", "$
510514
* @description Listens for language updates and changes translation accordingly
511515
*/
512516
scope.$on('gettextLanguageChanged', function () {
513-
update();
517+
update(interpolationContext);
514518
});
515519

516-
var interpolationContext = handleInterpolationContext(scope, attrs, update);
517-
update(interpolationContext);
518-
linking = false;
519520
}
520521
};
521522
}

dist/angular-gettext.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directive.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ angular.module('gettext').directive('translate', function (gettextCatalog, $pars
150150
$animate.leave(oldContents);
151151
}
152152

153+
var interpolationContext = handleInterpolationContext(scope, attrs, update);
154+
update(interpolationContext);
155+
linking = false;
156+
153157
if (attrs.translateN) {
154158
scope.$watch(attrs.translateN, function () {
155-
update();
159+
update(interpolationContext);
156160
});
157161
}
158162

@@ -163,12 +167,9 @@ angular.module('gettext').directive('translate', function (gettextCatalog, $pars
163167
* @description Listens for language updates and changes translation accordingly
164168
*/
165169
scope.$on('gettextLanguageChanged', function () {
166-
update();
170+
update(interpolationContext);
167171
});
168172

169-
var interpolationContext = handleInterpolationContext(scope, attrs, update);
170-
update(interpolationContext);
171-
linking = false;
172173
}
173174
};
174175
}

0 commit comments

Comments
 (0)