Skip to content

Commit a08c771

Browse files
authored
Merge pull request #6859 from manyfold3d/fix-attribute-translation-in-phlex
Fix use of translation strings in attributes for Phlex components/views
2 parents dc8cdcd + fe6c73e commit a08c771

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

app/components/base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ class Base < Phlex::HTML
66

77
# Include any helpers you want to be available across all components
88
include Phlex::Rails::Helpers::Routes
9-
include Phlex::Rails::Helpers::Translate
9+
10+
register_value_helper :t
11+
register_value_helper :translate
1012

1113
register_value_helper :current_user
1214
register_value_helper :policy

app/components/follow_button.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def render?
3535
def before_template
3636
case @following
3737
when :pending
38-
@i18n_key = ".pending" # i18n-tasks-use t('components.follow_button.pending')
38+
@i18n_key = "components.follow_button.pending" # i18n-tasks-use t('components.follow_button.pending')
3939
@icon = "hourglass-split"
4040
when :accepted
41-
@i18n_key = ".unfollow" # i18n-tasks-use t('components.follow_button.unfollow')
41+
@i18n_key = "components.follow_button.unfollow" # i18n-tasks-use t('components.follow_button.unfollow')
4242
@icon = "person-x-fill"
4343
else
44-
@i18n_key = ".follow" # i18n-tasks-use t('components.follow_button.follow')
44+
@i18n_key = "components.follow_button.follow" # i18n-tasks-use t('components.follow_button.follow')
4545
@icon = "person-plus-fill"
4646
end
4747
if @signed_out

0 commit comments

Comments
 (0)