From 0b1a4907ace1fd509220514c6d38057a73a42dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 16 Jul 2019 00:22:21 +0200 Subject: [PATCH] Load custom locales after everything is loaded The line: ``` config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}")] ``` Was adding every locale under the `config/locales` folder, including the ones inside `config/locales/custom/`. The files were loaded in the same order as listed using `ls -f`. So if the custom locales were loaded before the folder `config/locales/#{I18n.locale}`, the default locales would override the custom ones, and we want the custom locales to override the default ones so CONSUL is easier to customize. --- config/application.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index dcd309a5c..bb5a7580b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,7 +54,8 @@ module Consul "it" => "es", "pt-BR" => "es" } - config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}")] + + config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**[^custom]*", "*.{rb,yml}")] config.i18n.load_path += Dir[Rails.root.join("config", "locales", "custom", "**", "*.{rb,yml}")] config.after_initialize do