Вопрос

I am starting on translating my app and I've read the Rails I18n tutorial, but I don't understand how to refer to a certain key when organizing the locale files in folders

I have this file under /locales/layout/en.yml

en:
 header:
  search: "Search"

I've tried to refer it with

t( :search)
t( 'header.search')
t( 'header_search')

but it keeps telling me the key is missing

How would I write the key so it would refer the the proper translation key when under the layout folder in locales?

Это было полезно?

Решение

solved..

I had an error in the load files

the correct line is

config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top