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

Raise error if translations are used in initializer #1666

Merged
merged 7 commits into from Mar 28, 2023

Conversation

joelhawksley
Copy link
Member

@joelhawksley joelhawksley commented Feb 22, 2023

After exploring a potential solution in #1617, this PR raises a clear error that guides folks towards our recommended approach.

Closes #1577

cc @jcoyne

Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me 👍 Same thing we do when you try to call other helpers.

lib/view_component/base.rb Outdated Show resolved Hide resolved
@joelhawksley joelhawksley merged commit 73cd922 into main Mar 28, 2023
33 checks passed
@joelhawksley joelhawksley deleted the translations-in-initializer branch March 28, 2023 14:57
sandbergja added a commit to sandbergja/blacklight that referenced this pull request Apr 19, 2023
sandbergja added a commit to projectblacklight/blacklight that referenced this pull request Apr 19, 2023
* Use updated capybara filter_block syntax

teamcapybara/capybara#2617 changed
how blocks are evaluated.  Thanks to @maxkadel for finding
this change!

* rubocop -a

* ViewComponent 3 compatibility: don't call i18n methods in a component initializer

This is due to this upstream PR: ViewComponent/view_component#1666
sandbergja added a commit to sandbergja/blacklight that referenced this pull request Apr 27, 2023
* Use updated capybara filter_block syntax

teamcapybara/capybara#2617 changed
how blocks are evaluated.  Thanks to @maxkadel for finding
this change!

* rubocop -a

* ViewComponent 3 compatibility: don't call i18n methods in a component initializer

This is due to this upstream PR: ViewComponent/view_component#1666
cbeer pushed a commit to projectblacklight/blacklight that referenced this pull request Aug 10, 2023
* Use updated capybara filter_block syntax

teamcapybara/capybara#2617 changed
how blocks are evaluated.  Thanks to @maxkadel for finding
this change!

* rubocop -a

* ViewComponent 3 compatibility: don't call i18n methods in a component initializer

This is due to this upstream PR: ViewComponent/view_component#1666
cbeer pushed a commit to projectblacklight/blacklight that referenced this pull request Aug 10, 2023
* Use updated capybara filter_block syntax

teamcapybara/capybara#2617 changed
how blocks are evaluated.  Thanks to @maxkadel for finding
this change!

* rubocop -a

* ViewComponent 3 compatibility: don't call i18n methods in a component initializer

This is due to this upstream PR: ViewComponent/view_component#1666
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
* remove unnecessary include

* Raise error if translations are used in initializer

* Update base.rb

* Update initializer_translations_component.rb

* Update lib/view_component/base.rb
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
* remove unnecessary include

* Raise error if translations are used in initializer

* Update base.rb

* Update initializer_translations_component.rb

* Update lib/view_component/base.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relative translations don't work in initializer
2 participants