Created
May 28, 2012 17:49
-
-
Save juliend2/2820278 to your computer and use it in GitHub Desktop.
__() in javascript
This file contains hidden or 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
window._lang = 'fr'; | |
var translations = { | |
'String to Translate': 'Chaîne à traduire', | |
'something': 'quelque chose' | |
}; | |
var __ = function(msgid) { | |
if (window._lang === 'fr' && (msgid in translations)) { | |
return translations[msgid]; | |
} else { | |
return msgid; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment