Question

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?

Was it helpful?

Solution

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}')]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top