From 38e92e237862e07d65e0a9cc3324d14767b8b8f6 Mon Sep 17 00:00:00 2001 From: jasonych99 Date: Sat, 10 Dec 2016 16:22:39 +0100 Subject: [PATCH] add i18n_dir & default_locale to configuration --- .../base/base/config/initializers/react_on_rails.rb.tt | 7 +++++++ lib/react_on_rails/configuration.rb | 6 ++++++ spec/dummy/config/initializers/react_on_rails.rb | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt b/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt index 2e967a740..f03fa37e5 100644 --- a/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt +++ b/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt @@ -59,6 +59,13 @@ ReactOnRails.configure do |config| config.server_renderer_pool_size = 1 # increase if you're on JRuby config.server_renderer_timeout = 20 # seconds + ################################################################################ + # I18N OPTIONS + ################################################################################ + # Define the location of your translation.js + config.i18n_dir = nil + config.default_locale = "en" + ################################################################################ # MISCELLANEOUS OPTIONS ################################################################################ diff --git a/lib/react_on_rails/configuration.rb b/lib/react_on_rails/configuration.rb index 6c60b3eb5..21e257c62 100644 --- a/lib/react_on_rails/configuration.rb +++ b/lib/react_on_rails/configuration.rb @@ -59,6 +59,8 @@ def self.configuration server_render_method: "", symlink_non_digested_assets_regex: /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/, npm_build_test_command: "", + i18n_dir: nil, + default_locale: "", npm_build_production_command: "" ) end @@ -71,6 +73,7 @@ class Configuration :skip_display_none, :generated_assets_dirs, :generated_assets_dir, :webpack_generated_files, :rendering_extension, :npm_build_test_command, :npm_build_production_command, + :i18n_dir, :default_locale, :server_render_method, :symlink_non_digested_assets_regex def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil, @@ -81,12 +84,15 @@ def initialize(server_bundle_js_file: nil, prerender: nil, replay_console: nil, generated_assets_dir: nil, webpack_generated_files: nil, rendering_extension: nil, npm_build_test_command: nil, npm_build_production_command: nil, + i18n_dir: nil, default_locale: nil, server_render_method: nil, symlink_non_digested_assets_regex: nil) self.server_bundle_js_file = server_bundle_js_file self.generated_assets_dirs = generated_assets_dirs self.generated_assets_dir = generated_assets_dir self.npm_build_test_command = npm_build_test_command self.npm_build_production_command = npm_build_production_command + self.i18n_dir = i18n_dir + self.default_locale = default_locale self.prerender = prerender self.replay_console = replay_console diff --git a/spec/dummy/config/initializers/react_on_rails.rb b/spec/dummy/config/initializers/react_on_rails.rb index d6fec053c..61f8ffa8f 100644 --- a/spec/dummy/config/initializers/react_on_rails.rb +++ b/spec/dummy/config/initializers/react_on_rails.rb @@ -71,6 +71,13 @@ def self.custom_context(view_context) config.server_renderer_pool_size = 1 # increase if you're on JRuby config.server_renderer_timeout = 20 # seconds + ################################################################################ + # I18N OPTIONS + ################################################################################ + # Define the location of your translation.js + config.i18n_dir = nil + config.default_locale = "en" + ################################################################################ # MISCELLANEOUS OPTIONS ################################################################################