Open longnd opened 4 years ago
All of the texts are hardcoded, including the titles & notices. Shouldn't it be better to manage them in a locale file? From my experience, it's faster to hard coding the texts at first, but we will pay back when multi-languages support come in later, it's time-consuming and error-prone. https://github.com/pkordel/multisearch/blob/69d95b52581c40d1a4b4946fe397b24763eea630/app/controllers/reports_controller.rb#L5-L16
the instance variables @title are defined in the controller actions and then printed out in the view only. The value of the variable is also static. https://github.com/pkordel/multisearch/blob/69d95b52581c40d1a4b4946fe397b24763eea630/app/views/reports/_form.html.erb#L2 For that purpose, as mentioned before, isn't it better to defined them in a locale file and use it directly in the view without the need to define in the controller methods? Something like:
# in a report.en.yml locale file en: report: index: title: 'Reports' show: title: 'Search results' new: title: 'New Report' # and then on the view <h1 class="h3 mb-3 font-weight-normal"><%= t('report.index.title') %></h1>
All of the texts are hardcoded, including the titles & notices. Shouldn't it be better to manage them in a locale file? From my experience, it's faster to hard coding the texts at first, but we will pay back when multi-languages support come in later, it's time-consuming and error-prone. https://github.com/pkordel/multisearch/blob/69d95b52581c40d1a4b4946fe397b24763eea630/app/controllers/reports_controller.rb#L5-L16
the instance variables @title are defined in the controller actions and then printed out in the view only. The value of the variable is also static. https://github.com/pkordel/multisearch/blob/69d95b52581c40d1a4b4946fe397b24763eea630/app/views/reports/_form.html.erb#L2 For that purpose, as mentioned before, isn't it better to defined them in a locale file and use it directly in the view without the need to define in the controller methods? Something like: