Skip to content

Commit

Permalink
feat: auto detect language of browser purple-force#19
Browse files Browse the repository at this point in the history
Change-Id: I4443df8b4e169fc75b40438fb448814da972525b
  • Loading branch information
x-cold committed Jan 30, 2019
1 parent 5466c38 commit 23a0651
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion website/redirect.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<script>
window.rootPath = '<%= rootPath %>';
window.defaultLanguage = '<%= defaultLanguage %>';
var lang = Cookies.get('docsite_language');
var browserLang = navigator.language || navigator.userLanguage;
var lang = Cookies.get('docsite_language') || browserLang.toLowerCase();
if (!lang) {
lang = '<%= defaultLanguage %>';
}
Expand Down

0 comments on commit 23a0651

Please sign in to comment.