Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #2185
Closed
Open
Issue created May 02, 2022 by Administrator@rootContributor

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. Bildschirmfoto 2022-05-02 um 13 54 31 The nested Address record has no localized labels. The same view for the same record on its own SHOW page: Bildschirmfoto 2022-05-02 um 13 57 55

And the Addresses INDEX page: Bildschirmfoto 2022-05-02 um 13 58 04

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
Assignee
Assign to
Time tracking