I18n translations for nested resources on custom designs not working
Created by: 5minpause
Thank you for this wonderful gem.
-
What were you trying to do? I customized the designs to use TailwindCSS. Everything is working, but the translation for nested records does not work. The same models have their translations on their own index and show pages.
-
What did you end up with (logs, or, even better, example apps are great!)?
We are looking at a custom show page.
The nested Address
record has no localized labels. The same view for the same record on its own SHOW page:
The code to render the attributes on the SHOW page:
I believe it is almost the same as the original one.
<% page.attributes.each do |attribute| %>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500" id="<%= attribute.name %>">
<%= t(
"helpers.label.#{resource_name}.#{attribute.name}",
default: page.resource.class.human_attribute_name(attribute.name),
) %>
</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
<%= render_field attribute, page: page %>
</dd>
</div>
<% end %>
Do I need to edit some other files to achieve this?
- What versions are you running?
- Rails 7.0.2.4
- administrate 0.17.0