Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource_name does not use the host app's translation #820

Closed
ahx opened this issue Dec 7, 2011 · 8 comments
Closed

resource_name does not use the host app's translation #820

ahx opened this issue Dec 7, 2011 · 8 comments
Labels

Comments

@ahx
Copy link
Contributor

ahx commented Dec 7, 2011

If you put this in config/locales/en.yml (in the test-rails-app that's generated by ./script/local server),

en:
  hello: "Hello world"
  activerecord:
    models:
      category:
        one: Denomination
        other: Denominations

then start the app with ./script/local server
and open http://localhost:3000/admin/categories/5/edit
you get this: denominations mixed with categories

If you open a console you get:

ruby-1.9.2-p290 :001 > Category.model_name.human
 => "Denomination" 

Running AA edge (3c4ac59)
(this happen with both Rails 3.1.0 and 3.1.3)

@ahx
Copy link
Contributor Author

ahx commented Dec 7, 2011

As this has to do with memoizing Resource#resource_name (in development?), maybe there is a way to initialize AA after the host app has been fully loaded it's translations. Or maybe we should keep it simple and not memoize the value at all.

However, i am wondering if it is such a good idea to use the translation as a resource identifier. This is great for content like labels and headlines, but it leads to problems if the translation is used for routes, controller names and style attributes if you want to customize an admin area used with multiple locales.
Maybe we should use ActiveModel::Naming.singular(Category) as an internal identifier of the resource instead of the translation? (Should i add another ticket?)

@ahx
Copy link
Contributor Author

ahx commented Dec 7, 2011

This is related to #799

@pcreux
Copy link
Contributor

pcreux commented Dec 7, 2011

Is your issue solved with gem 'activeadmin', :git => 'https://github.com/pcreux/active_admin.git', :branch => "patch-issue-799"?

@ahx
Copy link
Contributor Author

ahx commented Dec 7, 2011

@pcreux nope. Still looks like on the screenshot above.

@ahx
Copy link
Contributor Author

ahx commented Dec 7, 2011

i have a question: how should one write a (failing) spec for this? I should add the translation via the spec/support/rails_template.rb and add a integration spec or cucumber feature, right?

@pcreux
Copy link
Contributor

pcreux commented Dec 7, 2011

We had a couple issues with i18n. I think that adding translations via the template, updating a few existing features and adding a new feature if needed would be great!

@ahx
Copy link
Contributor Author

ahx commented Dec 7, 2011

on it

@ahx
Copy link
Contributor Author

ahx commented Dec 13, 2011

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants