Created
November 18, 2011 12:33
-
-
Save Zegnat/1376327 to your computer and use it in GitHub Desktop.
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 tld = window.location.hostname.split('.').pop(), | |
tldExtend = {uk:'GB',za:'ZA',ie:'IE',au:'AU'}; | |
while (treeWalker.nextNode()) { | |
cN = treeWalker.currentNode; | |
cNlang = | |
cN.getAttribute('lang')||cN.getAttribute('xml:lang')|| | |
(('getAttribute' in cN.parentNode&&(l=cN.parentNode.getAttribute('lang')||cN.parentNode.getAttribute('xml:lang'))&&!cN.setAttribute('lang',l))?l:null)|| | |
window.navigator.language; | |
if (cNlang=='en'&&tld in tldExtend) cNlang+='-'+tldExtend[tld]; | |
// Gender swap with lists based on cNlang here! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment