-
-
Save oleander/6a3f1b3a4cf8de889e34 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
/* | |
t("products.price"); | |
*/ | |
$(function() { | |
window.t = function(key) { | |
if(!key){ | |
return "N/A"; | |
} | |
var keys = key.split("."); | |
var comp = window.I18n; | |
$(keys).each(function(_, value) { | |
if(comp){ | |
comp = comp[value]; | |
} | |
}); | |
if(!comp && console){ | |
console.debug("No translation found for key: " + key); | |
return "N/A"; | |
} | |
return comp; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe this should detects automatically the current app locale.
Just change line 11 from this:
To this: