I have a singular controller i want to add locales to that. It looks like
class AboutController < ApplicationController
def home
end
def markdown_syntax
end
end
And my about.en.yml
looks like
en:
about:
home:
discover_message: 'Discover, Track and Compare Open Source'
join_now: 'Join Now'
whats_new: "What's New"
popular_projects: 'Most Popular Projects'
active_projects: 'Most Active Projects'
I am getting translation missing error because it doesn't recognizing from about.en.yml
Error Message:
translation missing: en.about.home.discover_message
Try to specify name of the controller in the locale file like this:
I have also changed 1 space indentation to 2 space indentation, which is standard.
By default Rails is going to look for
en.yml
in theconfig/locales
directory.If you're using
about.en.yml
as the filename, then Rails is not going to find it unless you've configured things otherwise.