Chapter 15. Task J: Internationalization • p232
Missing locale: “I18n.locale” cause the cart to switch languages.
Change from
rails7/depot_s/app/views/store/_product.html.erb
<%= button_to t('.add_html'),
line_items_path(product_id: product),
form_class: 'inline',
class: 'ml-4 rounded-lg py-1 px-2 text-white bg-green-600' %>
to
rails7/depot_s/app/views/store/_product.html.erb
<%= button_to t('.add_html'),
line_items_path(product_id: product, locale: I18n.locale),
form_class: 'inline',
class: 'ml-4 rounded-lg py-1 px-2 text-white bg-green-600' %>