Sha256: 5df41b7cb7fd8069ba9d1dd84d8c414f48d099a8ec1fce8bf92be41b77a0d5be
Contents?: true
Size: 562 Bytes
Versions: 4
Compression:
Stored size: 562 Bytes
Contents
!function(exports){ var locale = <%=raw @locale.to_json %>; function get_key(key, context){ var path = key.split('.'), k = null; while(k = path.shift()){ if(context.hasOwnProperty(k)){ context = context[k]; } else{ throw Error('Translation missing: ' + key); } } return context; } exports.I18n = { t: function(key, context){ var str = get_key(key, locale); for(key in context){ str = str.replace("%{"+key+"}", context[key]); } return str; } } }(window);
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
locale_js-0.2.2 | app/views/locale/_i18n.js.erb |
locale_js-0.2.1 | app/views/locale/i18n.js.erb |
locale_js-0.2.0 | app/views/locale/i18n.js.erb |
locale_js-0.1.0 | app/views/locale/i18n.js.erb |