Skip to content

Commit dceccca

Browse files
committed
Merge pull request #4587 from MCGallaspy/lang-pack-js-fix
Fix language pack availability issue in 0.14.1
2 parents 306de74 + 290b4fc commit dceccca

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

kalite/updates/static/js/updates/update_languages.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ var installed_languages = [];
33
var downloading = false;
44

55
function version_comparison(v1, v2) {
6-
// compare two version strings and return 1 if the first is higher than the second,
7-
// -1 if the first is lower than the second, and 0 if they are equal
6+
/*
7+
compare two version strings and return 1 if the first is higher than the second,
8+
-1 if the first is lower than the second, and 0 if they are equal.
9+
10+
:params v1, v2: Version strings expected format is either "N.N.N" or "N.N", where N is a positive integer.
11+
If both strings have the same format, they're compared using a lexical order.
12+
If one string is shorter than the other, then the other is truncated and then compared using lexical order.
13+
*/
814
var v1parts = v1.split('.'), v2parts = v2.split('.');
9-
var maxLen = Math.max(v1parts.length, v2parts.length);
15+
var minLen = Math.min(v1parts.length, v2parts.length);
1016
var part1, part2;
11-
for(var i = 0; i < maxLen; i++) {
17+
for(var i = 0; i < minLen; i++) {
1218
part1 = parseInt(v1parts[i], 10) || 0;
1319
part2 = parseInt(v2parts[i], 10) || 0;
1420
if (part1 > part2) return 1;

0 commit comments

Comments
 (0)