Skip to content

Instantly share code, notes, and snippets.

@Alex4386
Created February 8, 2019 17:39
Show Gist options
  • Save Alex4386/20655adfdd2a92c2b175bc1419018784 to your computer and use it in GitHub Desktop.
Save Alex4386/20655adfdd2a92c2b175bc1419018784 to your computer and use it in GitHub Desktop.
Automatic Localization of babyshark song by SmartStudy Inc. via window.navigator.language
/* 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();
@hmmhmmhm
Copy link

hmmhmmhm commented Feb 8, 2019

아기 상어 뚜루루뚜루 귀여운 뚜루루뚜루 바닷 속 뚜루루뚜루 아기상어~

@Alex4386
Copy link
Author

Alex4386 commented May 6, 2019

와!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment