From d145e272f77aca4fce9df0a1025e93e631dd966f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 10 Oct 2014 00:22:48 +0200 Subject: [PATCH] Remove useless data/event binding on i18n directive. --- app/coffee/modules/base/i18n.coffee | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/coffee/modules/base/i18n.coffee b/app/coffee/modules/base/i18n.coffee index f9584746..6097cf6b 100644 --- a/app/coffee/modules/base/i18n.coffee +++ b/app/coffee/modules/base/i18n.coffee @@ -53,18 +53,14 @@ I18nDirective = ($rootscope, $i18n) -> link = ($scope, $el, $attrs) -> values = $attrs.tr.split(",") options = $attrs.trOpts or '{}' + opts = $scope.$eval(options) - applyTranslation = -> - opts = $scope.$eval(options) - for v in values - if v.indexOf(":") == -1 - $el.html(_.escape($scope.t(v, opts))) - else - [ns, v] = v.split(":") - $el.attr(ns, _.escape($scope.t(v, opts))) - - bindOnce($scope, "t", applyTranslation) - $scope.$on("i18n:changeLang", applyTranslation) + for v in values + if v.indexOf(":") == -1 + $el.html(_.escape($i18n.t(v, opts))) + else + [ns, v] = v.split(":") + $el.attr(ns, _.escape($i18n.t(v, opts))) return { link: link