Skip to content

Instantly share code, notes, and snippets.

@pi0
Last active September 30, 2017 07:47
Show Gist options
  • Save pi0/13e2a3248dbdebe82fbdf9d10766976c to your computer and use it in GitHub Desktop.
Save pi0/13e2a3248dbdebe82fbdf9d10766976c to your computer and use it in GitHub Desktop.
// https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
function get_locales() {
let all = document.getElementsByTagName('pre')[0].innerText
let regex = /Subtag: (.*)/
let match
let matches = []
while(match = regex.exec(all)) {
matches.push(match[1])
}
return matches
}
let locales = get_locales()
console.log(locales)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment