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
When nested object is namespaced, i18n key is invalid ("namespaced" too) #900
Comments
Would love to see a pull request for this! |
This one is going to be tricky! I've had a play around in the code, but I think we first need a decent plan of attack. We'll need to decide if it's best to remove the namespace as suggested above, or include it in a better way. Using the example above, we currently look for Assuming we have a solid view on what the right key is, we might need to support the existing behaviour ( I've bumped this out of 2.3.0 as a work-around exists and was documented in #964, and because I don't think there's a solid plan here yet. |
Proposed plan forward for the above
Given @stevo reported that Any thoughts before I try to implement? |
SimpleForm seems to have landed on |
Rails is using slashes in i18 keys. https://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb#L158 I would be for using the absolute names everywhere. It is obvious and explicit. |
@mikz it isn't clear to me how to get this resolved. If Rails supports slashes, feels like we should do the same. If we choose to do the same, do we need to do any work? |
Considering the original issue, I think Rails would try: |
@mikz would there be any change in Formtastic behaviour that you're aware of? If there's likely to be any subtle changes, I'd prefer to bump this out to 4.0. If it's okay for 3.2, maybe I'll start by adding tests to check existing behaviour? |
I18n allows fallbacks which could be used, so for sake of gradual change it should be done in phases. It would be hard to how a deprecation message though. But the final change should be definitely for 4.0. The 3.2 would be just adding support for the 'rails consistent' mode. (unless it is already consistent, dunno). |
I just tried this with Formtastic
The form correctly rendered the label for the |
i.e.
Shop::Project has_many Shop::Products
instead of looking for
it will look for
Probably changing
model_name, nested_model_name = normalize_model_name(self.model_name.underscore)
to
model_name, nested_model_name = normalize_model_name(self.model_name.demodulize.underscore)
should solve the problem
The text was updated successfully, but these errors were encountered: