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
  • #1072
Closed
Open
Issue created Jan 25, 2018 by Administrator@rootContributor

Text in links not fully translated

Created by: Na0na0

In /app/views/administrate/application/index.html.erb every links is not translated fully.

For example, when generating a link to create a new resource from a model named SubCategory:

  <div>
    <%= link_to(
      t(
        "administrate.actions.new_resource",
        name: page.resource_name.titleize.downcase
      ),
      [:new, namespace, page.resource_path],
      class: "button",
    ) if valid_action?(:new) && show_action?(:new, new_resource) %>
  </div>

in french, this will output something like this: <a class="button" href="/admin/sub_categories/new">Création sub category</a>

The word create will be translated correctly, but not the resource name sub category. The very useful display_resource_name helper, which calls human which itself calls translate could help achieve that.

      t(
        "administrate.actions.new_resource",
        name: display_resource_name(resource_name).downcase
      )

output in french: <a class="button" href="/admin/sub_categories/new">Création sous catégorie</a> Hooray!

That way, if our resource name is translated in your_locale.activerecord.models.your_model, it will be translated correctly and we can still handle format in your_locale.administrate.actions.new_resource.

I haven't had time to check the other views yet, but would you be interested in a pull request? I'm running a similar fix using 0.8.1 in production, it probably won't introduce breaking change on master.

Have a nice day and thanks for this gem, it works great!

Assignee
Assign to
Time tracking