Browse Source

feat(toolbar/language): add navigator language fallback preference

use navigator language if site language not specified
Josh Habdas 10 months ago
parent
commit
fa3efcea18
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      layouts/partials/modules/toxic-swamp/toolbar.html

+ 1
- 1
layouts/partials/modules/toxic-swamp/toolbar.html View File

@@ -38,7 +38,7 @@
38 38
     let locale = 'en';
39 39
     if (metadata.has('translations')) {
40 40
       const translations = JSON.parse(metadata.get('translations'));
41
-      const preferredLanguage = document.documentElement.lang;
41
+      const preferredLanguage = document.documentElement.lang || navigator.language;
42 42
       locale = (() => {
43 43
         const hasPreferred = translations.includes(preferredLanguage);
44 44
         if (hasPreferred) return preferredLanguage;

Loading…
Cancel
Save