Created
February 8, 2019 17:39
-
-
Save Alex4386/20655adfdd2a92c2b175bc1419018784 to your computer and use it in GitHub Desktop.
Automatic Localization of babyshark song by SmartStudy Inc. via window.navigator.language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Written for MintNetwork Yukari Cluster - 500 page handling */ | |
const bs = document.getElementById('babyshark'); | |
/* Localize babyshark */ | |
function localize(langCode) { | |
const country = window.navigator.userLanguage || window.navigator.language; | |
let ytCode = ""; | |
const lang = langCode || country.split('-')[0]; | |
switch (lang) { | |
case 'en': | |
ytCode = "R93ce4FZGbc"; | |
break; | |
case 'ja': | |
ytCode = "O3l1SW6sctw"; | |
break; | |
case 'zh': | |
ytCode = "4XcYhPHnLDs"; | |
break; | |
case 'ph': | |
ytCode = "QUPhFixdsBE"; | |
break; | |
/* Fallback to Korean if unavailable */ | |
case 'ko': | |
default: | |
ytCode = "761ae_KDg_Q"; | |
break; | |
} | |
bs.src = "https://www.youtube.com/embed/"+ytCode+"?autoplay=1"; | |
} | |
localize(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
아기 상어 뚜루루뚜루 귀여운 뚜루루뚜루 바닷 속 뚜루루뚜루 아기상어~