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

Fix translation lookup in partials #116

Merged
merged 4 commits into from
Aug 24, 2018
Merged

Fix translation lookup in partials #116

merged 4 commits into from
Aug 24, 2018

Conversation

stevschmid
Copy link
Contributor

@stevschmid stevschmid commented Aug 23, 2018

We noticed that the translation lookup in partials was broken. Using the helper t('.key') in partial bar within a component foo would lookup the key in the scope of bar_component instead of foo_component.

This PR addresses this issue. In the example above, the resulting key from the helper would be foo_component.bar.key

This PR is not compatible with the way komponent handles namespacing at the moment, please do not merge! Refer to #117

@coveralls
Copy link

coveralls commented Aug 23, 2018

Pull Request Test Coverage Report for Build 548

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 99.231%

Files with Coverage Reduction New Missed Lines %
lib/komponent/komponent_helper.rb 1 83.33%
Totals Coverage Status
Change from base Build 537: 0.04%
Covered Lines: 129
Relevant Lines: 130

💛 - Coveralls

@stevschmid stevschmid mentioned this pull request Aug 23, 2018
@Spone Spone added the bug label Aug 23, 2018
@stevschmid
Copy link
Contributor Author

I just added compatibility in 6b72af9 for the current namespacing layout (see #117).
It seems code climate does not like my code → "Cognitive Complexity of 6". Alas, I don't have the mental strength right now to address this too.

@Spone
Copy link
Collaborator

Spone commented Aug 23, 2018

Thanks! I'll take care of refactoring to make Code Climate happy.

@Spone
Copy link
Collaborator

Spone commented Aug 23, 2018

Done. Would you mind adding an item in the Changelog, and maybe describe this behavior in the Readme?

@stevschmid
Copy link
Contributor Author

Sure thing! I just added a line to the changelog. Do you think it's necessary to explain the behavior in the README? I personally think it's quite intuitive and consistent with the "Rails way".

@Spone
Copy link
Collaborator

Spone commented Aug 24, 2018

You're right, let's merge :)

@Spone Spone merged commit 0685c5c into komposable:master Aug 24, 2018
@bernardeli bernardeli mentioned this pull request Feb 18, 2019
Spone pushed a commit that referenced this pull request Feb 26, 2019
* Fix translation lookup in partials

* Address namespacing issue outlined in #117

* Refactor Translation#translate to reduce complexity

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants