forked from External/greenlight
Localized js is now served as json (#784)
This commit is contained in:
committed by
Jesus Federico
parent
061b69f962
commit
390ccf71c2
@ -45,23 +45,8 @@
|
||||
<%= stylesheet_link_tag themes_primary_path %>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Rail-ish function to translate a string, according to the Rails locales
|
||||
window.t = function t(key) {
|
||||
if (!key) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var keys = key.split('.');
|
||||
var value = <%= current_translations.to_json.html_safe %>; // Add I18n variables
|
||||
|
||||
keys.forEach(key => {
|
||||
if (value) {
|
||||
value = value[key];
|
||||
}
|
||||
});
|
||||
|
||||
return value ? value : "";
|
||||
}
|
||||
// Include the correct translated strings for Javascript
|
||||
window.I18n = <%= current_translations.to_json.html_safe %>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
Reference in New Issue
Block a user