Skip to content

Commit 8739333

Browse files
authored
Merge pull request bentorfs#25 from stand579/translate-labels
Support translation for labels
2 parents 50bea06 + 2464f96 commit 8739333

7 files changed

+59
-31
lines changed

dist/angular-bootstrap-multiselect-templates.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
1111
"\n" +
1212
" <li ng-show=\"showSelectAll\">\n" +
1313
" <a ng-click=\"selectAll()\" href=\"\">\n" +
14-
" <span class=\"glyphicon glyphicon-ok\"></span> Select All\n" +
14+
" <span class=\"glyphicon glyphicon-ok\"></span> {{labels.selectAll || 'Select All'}}\n" +
1515
" </a>\n" +
1616
" </li>\n" +
1717
" <li ng-show=\"showUnselectAll\">\n" +
1818
" <a ng-click=\"unselectAll()\" href=\"\">\n" +
19-
" <span class=\"glyphicon glyphicon-remove\"></span> Unselect All\n" +
19+
" <span class=\"glyphicon glyphicon-remove\"></span> {{labels.unselectAll || 'Unselect All'}}\n" +
2020
" </a>\n" +
2121
" </li>\n" +
2222
" <li ng-show=\"(showSelectAll || showUnselectAll)\"\n" +
@@ -34,7 +34,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
3434
" <li ng-show=\"showSearch\">\n" +
3535
" <div class=\"dropdown-header\">\n" +
3636
" <input type=\"text\" class=\"form-control input-sm\" style=\"width: 100%;\"\n" +
37-
" ng-model=\"searchFilter\" placeholder=\"Search...\" ng-change=\"updateOptions()\"/>\n" +
37+
" ng-model=\"searchFilter\" placeholder=\"{{labels.search || 'Search...'}}\" ng-change=\"updateOptions()\"/>\n" +
3838
" </div>\n" +
3939
" </li>\n" +
4040
"\n" +
@@ -49,7 +49,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
4949
"\n" +
5050
" <li class=\"divider\" ng-show=\"selectionLimit > 1\"></li>\n" +
5151
" <li role=\"presentation\" ng-show=\"selectionLimit > 1\">\n" +
52-
" <a>{{selectedOptions.length || 0}} / {{selectionLimit}} selected</a>\n" +
52+
" <a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || 'selected'}}</a>\n" +
5353
" </li>\n" +
5454
"\n" +
5555
" </ul>\n" +

dist/angular-bootstrap-multiselect.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@
2727
showSearch: '=?',
2828
searchFilter: '=?',
2929
disabled: '=?ngDisabled',
30-
defaultText: '@'
30+
labels: '=?'
3131
},
3232
require: 'ngModel',
3333
templateUrl: 'multiselect.html',
3434
link: function ($scope, $element, $attrs, $ngModelCtrl) {
3535
$scope.selectionLimit = $scope.selectionLimit || 0;
3636
$scope.searchLimit = $scope.searchLimit || 25;
37-
$scope.defaultText = $scope.defaultText || 'Select';
3837

3938
$scope.searchFilter = '';
4039

@@ -116,15 +115,14 @@
116115
return $scope.getDisplay($scope.selectedOptions[0]);
117116
}
118117
if ($scope.selectedOptions && $scope.selectedOptions.length > 1) {
119-
var totalSelected;
120-
totalSelected = angular.isDefined($scope.selectedOptions) ? $scope.selectedOptions.length : 0;
118+
var totalSelected = angular.isDefined($scope.selectedOptions) ? $scope.selectedOptions.length : 0;
121119
if (totalSelected === 0) {
122-
return $scope.defaultText;
120+
return $scope.labels && $scope.labels.select ? $scope.labels.select : 'Select';
123121
} else {
124-
return totalSelected + ' ' + 'selected';
122+
return totalSelected + ' ' + ($scope.labels && $scope.labels.itemsSelected ? $scope.labels.itemsSelected : 'selected');
125123
}
126124
} else {
127-
return $scope.defaultText;
125+
return $scope.labels && $scope.labels.select ? $scope.labels.select : 'Select';
128126
}
129127
};
130128

@@ -246,12 +244,12 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
246244
"\n" +
247245
" <li ng-show=\"showSelectAll\">\n" +
248246
" <a ng-click=\"selectAll()\" href=\"\">\n" +
249-
" <span class=\"glyphicon glyphicon-ok\"></span> Select All\n" +
247+
" <span class=\"glyphicon glyphicon-ok\"></span> {{labels.selectAll || 'Select All'}}\n" +
250248
" </a>\n" +
251249
" </li>\n" +
252250
" <li ng-show=\"showUnselectAll\">\n" +
253251
" <a ng-click=\"unselectAll()\" href=\"\">\n" +
254-
" <span class=\"glyphicon glyphicon-remove\"></span> Unselect All\n" +
252+
" <span class=\"glyphicon glyphicon-remove\"></span> {{labels.unselectAll || 'Unselect All'}}\n" +
255253
" </a>\n" +
256254
" </li>\n" +
257255
" <li ng-show=\"(showSelectAll || showUnselectAll)\"\n" +
@@ -269,7 +267,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
269267
" <li ng-show=\"showSearch\">\n" +
270268
" <div class=\"dropdown-header\">\n" +
271269
" <input type=\"text\" class=\"form-control input-sm\" style=\"width: 100%;\"\n" +
272-
" ng-model=\"searchFilter\" placeholder=\"Search...\" ng-change=\"updateOptions()\"/>\n" +
270+
" ng-model=\"searchFilter\" placeholder=\"{{labels.search || 'Search...'}}\" ng-change=\"updateOptions()\"/>\n" +
273271
" </div>\n" +
274272
" </li>\n" +
275273
"\n" +
@@ -284,7 +282,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
284282
"\n" +
285283
" <li class=\"divider\" ng-show=\"selectionLimit > 1\"></li>\n" +
286284
" <li role=\"presentation\" ng-show=\"selectionLimit > 1\">\n" +
287-
" <a>{{selectedOptions.length || 0}} / {{selectionLimit}} selected</a>\n" +
285+
" <a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || 'selected'}}</a>\n" +
288286
" </li>\n" +
289287
"\n" +
290288
" </ul>\n" +

dist/angular-bootstrap-multiselect.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.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"devDependencies": {
55
"grunt": "~0.4.5",
66
"grunt-bootlint": "~0.5.3",
7+
"grunt-bump": "~0.8.0",
78
"grunt-contrib-clean": "~0.5.0",
89
"grunt-contrib-concat": "~0.4.0",
910
"grunt-contrib-connect": "^0.9.0",
@@ -16,7 +17,7 @@
1617
"grunt-jscs": "~0.6.0",
1718
"grunt-karma": "~0.9.0",
1819
"grunt-maven-tasks": "~1.3.1",
19-
"grunt-ng-annotate": "^0.8.0",
20+
"grunt-ng-annotate": "~3.0.0",
2021
"grunt-protractor-runner": "~1.1.4",
2122
"karma": "~0.12.25",
2223
"karma-chrome-launcher": "~0.1.2",

src/multiselect.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
<li ng-show="showSelectAll">
99
<a ng-click="selectAll()" href="">
10-
<span class="glyphicon glyphicon-ok"></span> Select All
10+
<span class="glyphicon glyphicon-ok"></span> {{labels.selectAll || 'Select All'}}
1111
</a>
1212
</li>
1313
<li ng-show="showUnselectAll">
1414
<a ng-click="unselectAll()" href="">
15-
<span class="glyphicon glyphicon-remove"></span> Unselect All
15+
<span class="glyphicon glyphicon-remove"></span> {{labels.unselectAll || 'Unselect All'}}
1616
</a>
1717
</li>
1818
<li ng-show="(showSelectAll || showUnselectAll)"
@@ -30,7 +30,7 @@
3030
<li ng-show="showSearch">
3131
<div class="dropdown-header">
3232
<input type="text" class="form-control input-sm" style="width: 100%;"
33-
ng-model="searchFilter" placeholder="Search..." ng-change="updateOptions()"/>
33+
ng-model="searchFilter" placeholder="{{labels.search || 'Search...'}}" ng-change="updateOptions()"/>
3434
</div>
3535
</li>
3636

@@ -45,7 +45,7 @@
4545

4646
<li class="divider" ng-show="selectionLimit > 1"></li>
4747
<li role="presentation" ng-show="selectionLimit > 1">
48-
<a>{{selectedOptions.length || 0}} / {{selectionLimit}} selected</a>
48+
<a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || 'selected'}}</a>
4949
</li>
5050

5151
</ul>

0 commit comments

Comments
 (0)