forked from External/greenlight
Added mailer i18n (#436)
* Added mailer i18n * Added translation to mailer in the JS Also added a generic way to add JS translation through a javascript entry in the locale file * Moved line-breaks from translations to JS file
This commit is contained in:
committed by
Jesus Federico
parent
88776eaadb
commit
822dd27509
@ -32,6 +32,26 @@
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
<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 : "";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>" data-relative-root="<%= Rails.configuration.relative_url_root || "/" %>">
|
||||
|
Reference in New Issue
Block a user