JSCS Cleanup - use function syntax for i18n

Changed the declaration of i18n factory to fix the
angular/ng_di violation

Change-Id: I39efe672df8ebb8ea943b47d9f15fed8d9d08b7b
Partially-Implements: blueprint jscs-cleanup
This commit is contained in:
Rajat Vig 2015-07-15 09:06:21 -07:00
parent fa012c21ba
commit b0183de57b

View File

@ -16,27 +16,31 @@
(function () {
'use strict';
angular.module('horizon.framework.util.i18n', [])
angular
.module('horizon.framework.util.i18n', [])
.factory('horizon.framework.util.i18n.gettext', getText);
getText.$inject = ['$window'];
/*
* @name horizon.framework.util.i18n.gettext
* @description
* Provides a wrapper for translation, using the global 'gettext'
* function if it is present. Provides a method that
* simply returns the input if the expected global 'gettext' is
* not provided.
*
* Ideally once gettext is no longer needed on a global scope,
* the global ref can be deleted here. For now that is not possible.
* Also, if future alternate means were provided, we could put that
* logic here.
*
* This could also be done in the context of the filter, but
* the approach taken here was to separate business logic
* (translation) from filters, which are arguably more
* presentation-oriented.
*/
.factory('horizon.framework.util.i18n.gettext', ['$window', function ($window) {
* @name horizon.framework.util.i18n.gettext
* @description
* Provides a wrapper for translation, using the global 'gettext'
* function if it is present. Provides a method that
* simply returns the input if the expected global 'gettext' is
* not provided.
*
* Ideally once gettext is no longer needed on a global scope,
* the global ref can be deleted here. For now that is not possible.
* Also, if future alternate means were provided, we could put that
* logic here.
*
* This could also be done in the context of the filter, but
* the approach taken here was to separate business logic
* (translation) from filters, which are arguably more
* presentation-oriented.
*/
function getText($window) {
// If no global function, revert to just returning given text.
var gettextFunc = $window.gettext || function (x) { return x; };
@ -45,5 +49,5 @@
return function () {
return gettextFunc.apply(this, arguments);
};
}]);
}
})();