Skip to content

Commit

Permalink
move locale removal logic to compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhawksley committed Oct 15, 2024
1 parent 9054cf9 commit 17d0246
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def gather_templates
path: path,
lineno: 0,
extension: path.split(".").last,
this_format: this_format,
this_format: this_format.to_s.split(".").last&.to_sym, # strip locale from this_format, see #2113
variant: variant
)

Expand Down
6 changes: 1 addition & 5 deletions lib/view_component/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(
else
out = +"call"
out << "_#{normalized_variant_name}" if @variant.present?
out << "_#{@this_format}" if @this_format.present? && format_without_locale != ViewComponent::Base::VC_INTERNAL_DEFAULT_FORMAT
out << "_#{@this_format}" if @this_format.present? && @this_format != ViewComponent::Base::VC_INTERNAL_DEFAULT_FORMAT
out
end
end
Expand Down Expand Up @@ -72,10 +72,6 @@ def default_format?
@this_format == ViewComponent::Base::VC_INTERNAL_DEFAULT_FORMAT
end

def format_without_locale
@this_format.to_s.split(".").last.to_sym
end

def format
@this_format
end
Expand Down

0 comments on commit 17d0246

Please sign in to comment.