订单结算页面国际化与语言切换功能实现
1. 订单页面国际化
首先,我们进入到订单页面国际化的工作中。新订单页面的代码如下:
rails6/depot_t/app/views/orders/new.html.erb
<section class="depot_form">
<h1><%= t('.legend') %></h1>
<%= render 'form', order: @order %>
</section>
<%= javascript_pack_tag("pay_type") %>
该页面使用的表单代码如下:
rails6/depot_t/app/views/orders/_form.html.erb
<%= form_with(model: order, local: true) do |form| %>
<% if order.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(order.errors.count, "error") %> prohibited this order from being saved:</h2>
<ul>
<% order.errors.full_messages.each do
超级会员免费看
订阅专栏 解锁全文
47

被折叠的 条评论
为什么被折叠?



