[PATCH conductor] Add support for overriding default i18n file(s)

Jason Guiditta jguiditt at redhat.com
Thu Feb 16 22:05:51 UTC 2012


We need to be able to allow users to customize their install of
conductor to have their own names for things within the app.  This
simple patch adds that ability.  Note that it also allows for nesting
our i18n files, so we dont have to keep them in one giant file as
we do now.
---
 src/config/application.rb           |    3 ++-
 src/config/locales/overrides/README |    7 +++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
 create mode 100644 src/config/locales/overrides/README

diff --git a/src/config/application.rb b/src/config/application.rb
index f2295ab..9c0949f 100644
--- a/src/config/application.rb
+++ b/src/config/application.rb
@@ -81,7 +81,8 @@ module Conductor
     # config.time_zone = 'Central Time (US & Canada)'
 
     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
-    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
+    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'overrides','**', '*.{rb,yml}').to_s]
     # config.i18n.default_locale = :de
 
     # JavaScript files you want as :defaults (application.js is always included).
diff --git a/src/config/locales/overrides/README b/src/config/locales/overrides/README
new file mode 100644
index 0000000..b1089ca
--- /dev/null
+++ b/src/config/locales/overrides/README
@@ -0,0 +1,7 @@
+If you have a custom translation for a key used in the application,
+simply create the appropriate yml files/dirs for your supported languages in
+this directory and add the keys/values you want to use instead of the
+default.  See the rails guide on i18n for examples[1].  If you follow the
+pattern in the parent locales/ dir, everything shoudl 'just work'
+
+[1] http://guides.rubyonrails.org/i18n.html#organization-of-locale-files
-- 
1.7.7.6




More information about the aeolus-devel mailing list