【发布时间】:2023-03-02 21:47:01
【问题描述】:
我想用英语编程,但我的输出路径必须是另一种语言。
今天我正在使用以下方法,但我没有收到 index 操作,new 和 edit 仍然缺少翻译。我尝试使用test: one: other:,但没有成功。
resource :activities, path: I18n.t('routes.test')
# config/routes.rb
activities POST /teste(.:format) activities#create
new_activities GET /teste/new(.:format) activities#new
edit_activities GET /teste/edit(.:format) activities#edit
GET /teste(.:format) activities#show
PATCH /teste(.:format) activities#update
PUT /teste(.:format) activities#update
DELETE /teste(.:format) activities#destroy
# config/locales/routes.yml
fr:
routes:
test: "teste"
我怎样才能做到这一点?
【问题讨论】:
标签: ruby-on-rails-4 routes rails-i18n