Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change i18n directory check #899

Merged
merged 32 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cf5a710
change i18n directory check
hakongit Jul 18, 2017
8728504
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
fc26150
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
3f2be58
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
217d13f
added text to changelong.md
hakongit Jul 21, 2017
33eddf4
added test for i18n_dir = '' in addition to i18n_dir = nil, removed w…
hakongit Jul 22, 2017
c459351
removed examples.txt
hakongit Jul 22, 2017
f5cb8f0
added changes as suggested
hakongit Aug 5, 2017
6d0ba79
added changes as suggested
hakongit Aug 5, 2017
9024324
updated changelog.md
hakongit Aug 11, 2017
a5855ab
updated changelog.md
hakongit Aug 11, 2017
711ebe9
Merge branch 'master' into master
hakongit Aug 11, 2017
2b6267d
updated with check for i18n_yml_dir
hakongit Aug 29, 2017
05d9507
updated with check for i18n_yml_dir
hakongit Aug 29, 2017
665a019
change i18n directory check
hakongit Jul 18, 2017
896c539
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
746bb80
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
05b5549
added test for i18n_dir = nil and check for nil?
hakongit Jul 21, 2017
7ceb171
added text to changelong.md
hakongit Jul 21, 2017
15ea210
added test for i18n_dir = '' in addition to i18n_dir = nil, removed w…
hakongit Jul 22, 2017
a42ceab
removed examples.txt
hakongit Jul 22, 2017
445e1ed
added changes as suggested
hakongit Aug 5, 2017
e4ea7e3
added changes as suggested
hakongit Aug 5, 2017
203b489
updated changelog.md
hakongit Aug 11, 2017
fc7eff2
updated changelog.md
hakongit Aug 11, 2017
39fe5b2
updated with check for i18n_yml_dir
hakongit Aug 29, 2017
8804ddf
updated with check for i18n_yml_dir
hakongit Aug 29, 2017
e555441
rebased on top of master
hakongit Oct 24, 2017
40cd6ae
rebased on top of master
hakongit Oct 24, 2017
69a2ef5
squashed comments
hakongit Oct 25, 2017
3b38dd1
squashed comments
hakongit Oct 25, 2017
152aeca
squashed comments
hakongit Oct 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changes since last non-beta release.
- Fixed `react_component_hash` functionality in cases of prerendering errors: [PR 960](https://github.com/shakacode/react_on_rails/pull/960) by [Judahmeek](https://github.com/Judahmeek)

*Please add entries here for your pull requests.*
- Fixes check for i18n_dir in LocalesToJs returning false when i18n_dir was set. [PR 899](https://github.com/shakacode/react_on_rails/pull/899) by [hakongit](https://github.com/hakongit)

### [10.0.0] - 2017-10-08
#### Created
Expand Down
5 changes: 4 additions & 1 deletion lib/react_on_rails/locales_to_js.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
module ReactOnRails
class LocalesToJs
def initialize
return if i18n_dir.blank?
if !i18n_dir.nil? && !File.directory?(i18n_dir)
raise "config.i18n_dir is set and it is not a directory. Did you set config.i18n_dir in the react_on_rails initializer?"
end
return if i18n_yml_dir.nil?
return unless obsolete?
@translations, @defaults = generate_translations
convert
Expand Down
7 changes: 7 additions & 0 deletions spec/react_on_rails/locales_to_js_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ module ReactOnRails
let(:translations_path) { "#{i18n_dir}/translations.js" }
let(:default_path) { "#{i18n_dir}/default.js" }

it "with i18n_dir set to ''" do
ReactOnRails.configure do |config|
config.i18n_dir = ''
end
expect { ReactOnRails::LocalesToJs.new }.to raise_error(/config.i18n_dir is set and it is not a directory. Did you set config.i18n_dir in the react_on_rails initializer?/)
end

shared_examples "locale to js" do
context "with obsolete js files" do
before do
Expand Down