Last active
August 29, 2015 14:02
-
-
Save bjmiller121/eb3a8d0e3460327677ef to your computer and use it in GitHub Desktop.
Get language code of a page in 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
var path = window.location.pathname.split('/')[1], | |
lang = /\w\w\-\w\w/.test(path) ? path.split('-')[0] : 'en'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment