Skip to content

Commit

Permalink
Refactoring: remove redundant gettext annotations
Browse files Browse the repository at this point in the history
In the javascript code, the call to gettext() does nothing except
annotates the string for extraction by l10n-extract. This has been
necessary in the past but nowadays call to gettextCatalog.getString()
does that automatically. Hence, all the calls to gettext() were just
unnecessary clutter.

See e.g. rubenv/angular-gettext#19
  • Loading branch information
paulijar committed Jul 20, 2018
1 parent 4c21df4 commit f323265
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions js/app/controllers/maincontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

angular.module('Music').controller('MainController', [
'$rootScope', '$scope', '$timeout', '$window', 'ArtistFactory',
'playlistService', 'libraryService', 'gettext', 'gettextCatalog', 'Restangular',
'playlistService', 'libraryService', 'gettextCatalog', 'Restangular',
function ($rootScope, $scope, $timeout, $window, ArtistFactory,
playlistService, libraryService, gettext, gettextCatalog, Restangular) {
playlistService, libraryService, gettextCatalog, Restangular) {

// retrieve language from backend - is set in ng-app HTML element
gettextCatalog.currentLanguage = $rootScope.lang;
Expand Down Expand Up @@ -105,17 +105,17 @@ function ($rootScope, $scope, $timeout, $window, ArtistFactory,
var reason = null;
switch (response.status) {
case 500:
reason = gettextCatalog.getString(gettext('Internal server error'));
reason = gettextCatalog.getString('Internal server error');
break;
case 504:
reason = gettextCatalog.getString(gettext('Timeout'));
reason = gettextCatalog.getString('Timeout');
break;
default:
reason = response.status;
break;
}
OC.Notification.showTemporary(
gettextCatalog.getString(gettext('Failed to load the collection: ')) + reason);
gettextCatalog.getString('Failed to load the collection: ') + reason);
});

};
Expand Down
6 changes: 3 additions & 3 deletions js/app/controllers/overviewcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

angular.module('Music').controller('OverviewController', [
'$scope', '$rootScope', 'playlistService', 'libraryService',
'Restangular', '$route', '$timeout', 'gettext', 'gettextCatalog',
'Restangular', '$route', '$timeout', 'gettextCatalog',
function ($scope, $rootScope, playlistService, libraryService,
Restangular, $route, $timeout, gettext, gettextCatalog) {
Restangular, $route, $timeout, gettextCatalog) {

$rootScope.currentView = '#';

Expand Down Expand Up @@ -176,7 +176,7 @@ angular.module('Music').controller('OverviewController', [
}
}
catch (exception) {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Requested entry was not found')));
OC.Notification.showTemporary(gettextCatalog.getString('Requested entry was not found'));
window.location.hash = '#/';
}
}
Expand Down
6 changes: 3 additions & 3 deletions js/app/controllers/playercontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

angular.module('Music').controller('PlayerController', [
'$scope', '$rootScope', 'playlistService', 'libraryService',
'Audio', 'Restangular', 'gettext', 'gettextCatalog', '$timeout',
'Audio', 'Restangular', 'gettextCatalog', '$timeout',
function ($scope, $rootScope, playlistService, libraryService,
Audio, Restangular, gettext, gettextCatalog, $timeout) {
Audio, Restangular, gettextCatalog, $timeout) {

$scope.loading = false;
$scope.player = Audio;
Expand Down Expand Up @@ -191,7 +191,7 @@ function ($scope, $rootScope, playlistService, libraryService,
entry = playlistService.jumpToNextTrack($scope.repeat, $scope.shuffle);
}
if(tracksSkipped) {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Some not playable tracks were skipped.')));
OC.Notification.showTemporary(gettextCatalog.getString('Some not playable tracks were skipped.'));
}
setCurrentTrack(entry);
};
Expand Down
6 changes: 3 additions & 3 deletions js/app/controllers/playlistviewcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

angular.module('Music').controller('PlaylistViewController', [
'$rootScope', '$scope', '$routeParams', 'playlistService', 'libraryService',
'gettext', 'gettextCatalog', 'Restangular', '$timeout',
'gettextCatalog', 'Restangular', '$timeout',
function ($rootScope, $scope, $routeParams, playlistService, libraryService,
gettext, gettextCatalog, Restangular, $timeout) {
gettextCatalog, Restangular, $timeout) {

var INCREMENTAL_LOAD_STEP = 1000;
$scope.incrementalLoadLimit = INCREMENTAL_LOAD_STEP;
Expand Down Expand Up @@ -176,7 +176,7 @@ angular.module('Music').controller('PlaylistViewController', [
$scope.tracks = playlist.tracks;
}
else {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Requested entry was not found')));
OC.Notification.showTemporary(gettextCatalog.getString('Requested entry was not found'));
window.location.hash = '#/';
}
}
Expand Down
10 changes: 5 additions & 5 deletions js/app/controllers/settingsviewcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/

angular.module('Music').controller('SettingsViewController', [
'$scope', '$rootScope', 'Restangular', '$window', '$timeout', 'gettext', 'gettextCatalog',
function ($scope, $rootScope, Restangular, $window, $timeout, gettext, gettextCatalog) {
'$scope', '$rootScope', 'Restangular', '$window', '$timeout', 'gettextCatalog',
function ($scope, $rootScope, Restangular, $window, $timeout, gettextCatalog) {

$rootScope.currentView = window.location.hash;

Expand All @@ -29,7 +29,7 @@ angular.module('Music').controller('SettingsViewController', [

$scope.selectPath = function() {
OC.dialogs.filepicker(
gettextCatalog.getString(gettext('Path to your music collection')),
gettextCatalog.getString('Path to your music collection'),
function (path) {
if (path.substr(-1) !== '/') {
path = path + '/';
Expand Down Expand Up @@ -64,8 +64,8 @@ angular.module('Music').controller('SettingsViewController', [

$scope.resetCollection = function() {
OC.dialogs.confirm(
gettextCatalog.getString(gettext('Are you sure to reset the music collection? This removes all scanned tracks and user-created playlists!')),
gettextCatalog.getString(gettext('Reset music collection')),
gettextCatalog.getString('Are you sure to reset the music collection? This removes all scanned tracks and user-created playlists!'),
gettextCatalog.getString('Reset music collection'),
function(confirmed) {
if (confirmed) {
$scope.resetOngoing = true;
Expand Down
38 changes: 19 additions & 19 deletions js/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ angular.module('Music').controller('DetailsController', [

angular.module('Music').controller('MainController', [
'$rootScope', '$scope', '$timeout', '$window', 'ArtistFactory',
'playlistService', 'libraryService', 'gettext', 'gettextCatalog', 'Restangular',
'playlistService', 'libraryService', 'gettextCatalog', 'Restangular',
function ($rootScope, $scope, $timeout, $window, ArtistFactory,
playlistService, libraryService, gettext, gettextCatalog, Restangular) {
playlistService, libraryService, gettextCatalog, Restangular) {

// retrieve language from backend - is set in ng-app HTML element
gettextCatalog.currentLanguage = $rootScope.lang;
Expand Down Expand Up @@ -412,17 +412,17 @@ function ($rootScope, $scope, $timeout, $window, ArtistFactory,
var reason = null;
switch (response.status) {
case 500:
reason = gettextCatalog.getString(gettext('Internal server error'));
reason = gettextCatalog.getString('Internal server error');
break;
case 504:
reason = gettextCatalog.getString(gettext('Timeout'));
reason = gettextCatalog.getString('Timeout');
break;
default:
reason = response.status;
break;
}
OC.Notification.showTemporary(
gettextCatalog.getString(gettext('Failed to load the collection: ')) + reason);
gettextCatalog.getString('Failed to load the collection: ') + reason);
});

};
Expand Down Expand Up @@ -767,9 +767,9 @@ angular.module('Music').controller('NavigationController', [

angular.module('Music').controller('OverviewController', [
'$scope', '$rootScope', 'playlistService', 'libraryService',
'Restangular', '$route', '$timeout', 'gettext', 'gettextCatalog',
'Restangular', '$route', '$timeout', 'gettextCatalog',
function ($scope, $rootScope, playlistService, libraryService,
Restangular, $route, $timeout, gettext, gettextCatalog) {
Restangular, $route, $timeout, gettextCatalog) {

$rootScope.currentView = '#';

Expand Down Expand Up @@ -931,7 +931,7 @@ angular.module('Music').controller('OverviewController', [
}
}
catch (exception) {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Requested entry was not found')));
OC.Notification.showTemporary(gettextCatalog.getString('Requested entry was not found'));
window.location.hash = '#/';
}
}
Expand Down Expand Up @@ -982,9 +982,9 @@ angular.module('Music').controller('OverviewController', [

angular.module('Music').controller('PlayerController', [
'$scope', '$rootScope', 'playlistService', 'libraryService',
'Audio', 'Restangular', 'gettext', 'gettextCatalog', '$timeout',
'Audio', 'Restangular', 'gettextCatalog', '$timeout',
function ($scope, $rootScope, playlistService, libraryService,
Audio, Restangular, gettext, gettextCatalog, $timeout) {
Audio, Restangular, gettextCatalog, $timeout) {

$scope.loading = false;
$scope.player = Audio;
Expand Down Expand Up @@ -1160,7 +1160,7 @@ function ($scope, $rootScope, playlistService, libraryService,
entry = playlistService.jumpToNextTrack($scope.repeat, $scope.shuffle);
}
if(tracksSkipped) {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Some not playable tracks were skipped.')));
OC.Notification.showTemporary(gettextCatalog.getString('Some not playable tracks were skipped.'));
}
setCurrentTrack(entry);
};
Expand Down Expand Up @@ -1196,9 +1196,9 @@ function ($scope, $rootScope, playlistService, libraryService,

angular.module('Music').controller('PlaylistViewController', [
'$rootScope', '$scope', '$routeParams', 'playlistService', 'libraryService',
'gettext', 'gettextCatalog', 'Restangular', '$timeout',
'gettextCatalog', 'Restangular', '$timeout',
function ($rootScope, $scope, $routeParams, playlistService, libraryService,
gettext, gettextCatalog, Restangular, $timeout) {
gettextCatalog, Restangular, $timeout) {

var INCREMENTAL_LOAD_STEP = 1000;
$scope.incrementalLoadLimit = INCREMENTAL_LOAD_STEP;
Expand Down Expand Up @@ -1359,7 +1359,7 @@ angular.module('Music').controller('PlaylistViewController', [
$scope.tracks = playlist.tracks;
}
else {
OC.Notification.showTemporary(gettextCatalog.getString(gettext('Requested entry was not found')));
OC.Notification.showTemporary(gettextCatalog.getString('Requested entry was not found'));
window.location.hash = '#/';
}
}
Expand All @@ -1385,8 +1385,8 @@ angular.module('Music').controller('PlaylistViewController', [
]);

angular.module('Music').controller('SettingsViewController', [
'$scope', '$rootScope', 'Restangular', '$window', '$timeout', 'gettext', 'gettextCatalog',
function ($scope, $rootScope, Restangular, $window, $timeout, gettext, gettextCatalog) {
'$scope', '$rootScope', 'Restangular', '$window', '$timeout', 'gettextCatalog',
function ($scope, $rootScope, Restangular, $window, $timeout, gettextCatalog) {

$rootScope.currentView = window.location.hash;

Expand All @@ -1403,7 +1403,7 @@ angular.module('Music').controller('SettingsViewController', [

$scope.selectPath = function() {
OC.dialogs.filepicker(
gettextCatalog.getString(gettext('Path to your music collection')),
gettextCatalog.getString('Path to your music collection'),
function (path) {
if (path.substr(-1) !== '/') {
path = path + '/';
Expand Down Expand Up @@ -1438,8 +1438,8 @@ angular.module('Music').controller('SettingsViewController', [

$scope.resetCollection = function() {
OC.dialogs.confirm(
gettextCatalog.getString(gettext('Are you sure to reset the music collection? This removes all scanned tracks and user-created playlists!')),
gettextCatalog.getString(gettext('Reset music collection')),
gettextCatalog.getString('Are you sure to reset the music collection? This removes all scanned tracks and user-created playlists!'),
gettextCatalog.getString('Reset music collection'),
function(confirmed) {
if (confirmed) {
$scope.resetOngoing = true;
Expand Down

0 comments on commit f323265

Please sign in to comment.