Skip to content

Commit 3a82894

Browse files
committed
Improve language detection from book.json
1 parent 4079de9 commit 3a82894

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/utils/i18n.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ var getByLanguage = function(lang) {
2929

3030
var compareLocales = function(lang, locale) {
3131
var langMain = _.first(lang.split("-"));
32+
var langSecond = _.last(lang.split("-"));
33+
3234
var localeMain = _.first(locale.split("-"));
35+
var localeSecond = _.last(locale.split("-"));
3336

3437
if (locale == lang) return 100;
3538
if (localeMain == langMain) return 50;
39+
if (localeSecond == langSecond) return 20;
3640
return 0;
3741
};
3842

0 commit comments

Comments
 (0)