Skip to content

Commit

Permalink
add i18n_dir & default_locale to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonYCHuang committed Dec 10, 2016
1 parent 6370447 commit 38e92e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down
6 changes: 6 additions & 0 deletions lib/react_on_rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions spec/dummy/config/initializers/react_on_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down

0 comments on commit 38e92e2

Please sign in to comment.