Created
September 6, 2016 10:29
-
-
Save arvi/56cace261ed2900c84466befdb7d1a0b to your computer and use it in GitHub Desktop.
jQuery's i18next counterpart on vanilla js
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
//translates text to user's preferred language | |
for (i = 0; i < document.querySelectorAll('[data-i18n]').length; i++) { | |
document.querySelectorAll('[data-i18n]')[i].innerHTML = i18next.t(document.querySelectorAll('[data-i18n]')[i].getAttribute("data-i18n")); | |
} | |
//source: https://github.com/i18next/i18next/issues/398#issuecomment-241671697 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment