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

Add an i18n functionality to change language using a dropdown in real time. #340

Merged
merged 14 commits into from
Mar 2, 2017

Conversation

JasonYCHuang
Copy link
Contributor

@JasonYCHuang JasonYCHuang commented Nov 12, 2016

Add an i18n functionality to React Router Demo, React Demo and Simple React tabs.
You can now change language using the dropdown in real time.

issue #120

i18n


This change is Reviewable

@JasonYCHuang JasonYCHuang changed the title Add a i18n functionality to change language using a dropdown in real time. Add an i18n functionality to change language using a dropdown in real time. Nov 12, 2016
@justin808
Copy link
Member

@JasonYCHuang This looks amazing.

@martyphee Could you give me a hand with this review?


Review status: 0 of 23 files reviewed at latest revision, 1 unresolved discussion.


public/javascripts/i18n.js, line 1 at r1 (raw file):

// I18n.js

@JasonYCHuang Should we put this inside the React on Rails source code? Where did this file come from? Rails?


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

@justin808 public/javascripts/i18n.js is generated by gem i18n-js.

quote from https://github.com/fnando/i18n-js

Current version of i18n.js will also be exported to avoid version mismatching by downloading.

I will check whether it can be removed or not.
Give you response later.

@martyphee
Copy link

Looks good. I was wondering about the js file also. Seems like it's included twice. Once with the Gem and then package.json.


Review status: 0 of 23 files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

JasonYCHuang commented Nov 14, 2016

@justin808 @martyphee
I decide to add public/javascripts/i18n.js to .gitignore.

This file is generated by the gem automatically.

Therefore, I think that putting public/javascripts/i18n.js to .gitignore brings in
less configurations or rake tasks and reduces confusion for readers.
People can choose their preference on i18n-js configurations, and this should be out of scope for this app.

What do you think about this?

@justin808
Copy link
Member

@alexfedoseev suggested we consider: https://github.com/yahoo/react-intl

@JasonYCHuang Yes, gitignore a generated file!

@JasonYCHuang
Copy link
Contributor Author

JasonYCHuang commented Nov 15, 2016

@justin808 good suggestions, I will take a look on react-intl.

@justin808
Copy link
Member

@JasonYCHuang @martyphee @alexfedoseev @robwise Once we decide that that https://github.com/yahoo/react-intl is not the way to go for a rails app, it probably makes sense to merge this. Agree, everybody? Or will this make the example too complicated, and it should be left as a PR to demonstrate this? I do think that i18n is an increasingly important basic thing for all apps to handle.

@Judahmeek
Copy link
Contributor

@justin808 Internationalization seems like a front end issue to me. Since you've largely supporting having node & javascript handle front end issues, I'd think that you'd want to see internationalization handled by https://github.com/yahoo/react-intl or https://github.com/i18next/i18next.

Awesome PR, btw, @JasonYCHuang

@JasonYCHuang JasonYCHuang force-pushed the i18n branch 2 times, most recently from 7fdf4aa to 3c0d60c Compare November 26, 2016 10:31
@JasonYCHuang
Copy link
Contributor Author

JasonYCHuang commented Nov 26, 2016

@justin808 I add react-intl into the project, and there is no i18n-js dependency in both front-end & back-end.

If users want to use i18n-js in front-end, they can just switch to b565d9b integrate i18n-js.

Meanwhile, I find there is no need to use i18n-js gem for back-end, and locale-yml-to-json logics are left in config/initializers/react_on_rails.rb.

PS: Not sure why the test is fail. It is pass on my local. I will take a look later.

@justin808
Copy link
Member

@JasonYCHuang OMG! This is so great!

I'm starting to think that we could hoist some of this into the react-on-rails npm package in case one wants to get some of the translation files as defined by Rails. However, for many apps, they might not need the rails translations, and so just having some great docs and this example will suffice.

CC: @alexfedoseev @robwise @martyphee @alleycat-at-git


Reviewed 20 of 23 files at r1, 4 of 4 files at r2, 13 of 20 files at r3.
Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


client/app/bundles/comments/common/i18nHelper.jsx, line 28 at r3 (raw file):

  type: {
    id: 'type',
    defaultMessage: 'English',

Should default messages be here?

If we were going to give the i18n files to a team of translators...should we put the defaults into a separate file?

Maybe yes. Maybe no. There are probably tradeoffs.

Possibly if the developers only have to work on this one file, that's better.


client/app/bundles/comments/common/i18nHelper.jsx, line 110 at r3 (raw file):

    }, {});
  };
};

We're using lodash freely in this project, so this could be much simpler using lodash.

However, if we may want to host this up to the react-on-rails npm library, then this is the way to go.

CC: @alexfedoseev @robwise


client/app/bundles/comments/components/CommentBox/CommentBox.jsx, line 44 at r3 (raw file):

      <div className="commentBox container">
        <h2>
          Comments {data.get('isFetching') && 'Loading...'}

are we losing the Loading... indicator? this should only show when a remote call is happening.


client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx, line 18 at r3 (raw file):

import _ from 'lodash';
import { injectIntl, intlShape } from 'react-intl';
import { defaultMessages } from '../../../common/i18nHelper';

this should be from '/libs' rather than lots of ../../...


client/app/bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen.jsx, line 53 at r3 (raw file):

        <InjectedSimpleCommentScreen
          {...this.props}
          selectLanguage={SelectLanguage.bind(this, this.handleSetLocale, locale)}

@robwise @alexfedoseev should we use bind here or a fat arrow function? It's actually not clear to me on why we are calling bind. This seems really to be a curry.


config/initializers/react_on_rails.rb, line 17 at r3 (raw file):

    Dir[Rails.root.join("config", "locales", "*.yml")]
  end
end

@JasonYCHuang @robwise @alexfedoseev This doesn't seem right in that we pass the locale strings in the rails context every time.

These should be built using a rake task that puts these into the generated files directory, and ideally, they should be lazily loaded as needed. (System.import?)

@martyphee, please review.

Essentially, if we had lots of translations, every page we render will have tons of rails context data to get parsed by the browser.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

@justin808 Thanks for great suggestions.

I also have questions in my mind while doing this branch.
Some of codes should be separated or hoisted, but I am not sure which way is better.


Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


client/app/bundles/comments/common/i18nHelper.jsx, line 28 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote… > Should default messages be here? > > If we were going to give the i18n files to a team of translators...should we put the defaults into a separate file? > > Maybe yes. Maybe no. There are probably tradeoffs. > > Possibly if the developers only have to work on this one file, that's better.
Yes, it is better to have this in separate files.

react-intl doesn't support tree-structure translations as what we do on rails.
We need a place to transform and keep default en.yml into the format like this, not hard-coding it.

How about a rake task to convert config/locales/en.yml, and generate a defaultMessages into client/app/libs?



---

*[config/initializers/react_on_rails.rb, line 17 at r3](https://reviewable.io:443/reviews/shakacode/react-webpack-rails-tutorial/340#-KXXmzSbvGll7h4b0RxV:-KX_DuS4PqaiSiPq58eB:b-ym1vqf) ([raw file](https://github.com/shakacode/react-webpack-rails-tutorial/blob/3c0d60cf8da9ec9e5b24e85d350d1a8aba82ccd0/config/initializers/react_on_rails.rb#L17)):*
<details><summary><i>Previously, justin808 (Justin Gordon) wrote…</i></summary>
> @jasonychuang @robwise @alexfedoseev This doesn't seem right in that we pass the locale strings in the rails context every time.
> 
> These should be built using a rake task that puts these into the generated files directory, and ideally, they should be lazily loaded as needed. (System.import?)
> 
> @martyphee, please review. 
> 
> Essentially, if we had lots of translations, every page we render will have tons of rails context data to get parsed by the browser.
> 
> 
</details>
Agree. A rake task converts ```config/locales/*.yml``` into JS files.
How about putting these JS files in ```client/app/libs``` with ```defaultMessages```?

---


*Comments from [Reviewable](https://reviewable.io:443/reviews/shakacode/react-webpack-rails-tutorial/340#-:-KX_BfVh39h1FA8T9Pyv:ba2bavz)*
<!-- Sent from Reviewable.io -->

@justin808
Copy link
Member

We can screen hero or video chat if you like [email protected].


Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


client/app/bundles/comments/common/i18nHelper.jsx, line 28 at r3 (raw file):

Previously, JasonYCHuang (Jason Huang) wrote… > Yes, it is better to have this in separate files. > > ```react-intl``` doesn't support tree-structure translations as what we do on rails. > We need a place to transform and keep default ```en.yml``` into the format like this, not hard-coding it. > > How about a rake task to convert ```config/locales/en.yml```, and generate a ```defaultMessages``` into ```client/app/libs```?
I think we should make a generic rake task and put that into react on rails.

config/initializers/react_on_rails.rb, line 17 at r3 (raw file):

Previously, JasonYCHuang (Jason Huang) wrote… > Agree. A rake task converts ```config/locales/*.yml``` into JS files. > How about putting these JS files in ```client/app/libs``` with ```defaultMessages```?
Sounds good!

We can first make this work here, and then add to React on Rails if the rake task is generic enough.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

Review status: 10 of 23 files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx, line 18 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

this should be from '/libs' rather than lots of ../../...

Done.


client/app/bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen.jsx, line 53 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@robwise @alexfedoseev should we use bind here or a fat arrow function? It's actually not clear to me on why we are calling bind. This seems really to be a curry.

Done. remove curry syntax.


config/initializers/react_on_rails.rb, line 17 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

Sounds good!

We can first make this work here, and then add to React on Rails if the rake task is generic enough.

Done.


client/app/bundles/comments/common/i18nHelper.jsx, line 28 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I think we should make a generic rake task and put that into react on rails.

Use rake to generate translations & default translations.


client/app/bundles/comments/common/i18nHelper.jsx, line 110 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

We're using lodash freely in this project, so this could be much simpler using lodash.

However, if we may want to host this up to the react-on-rails npm library, then this is the way to go.

CC: @alexfedoseev @robwise

I put locales-preprocessing into rake, and lodash is no longer needed here.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

  1. run rake i18n:to_js to generate client/app/libs/i18n/translations.js & default.js
  2. We need i18n_dir & default_locale in ReactOnRails configuration. Currently, I use react_on_rails from my repository, and this will be fixed when react_on_rails/pull/642 is merged. Automatically generate i18n javascript files for react-intl when the serve starts up. react_on_rails#642

ps: remove i18n-js to speed up development. If it is needed, we can add it back later.

@justin808
Copy link
Member

@JasonYCHuang AWESOME!!!!

ps: remove i18n-js to speed up development. If it is needed, we can add it back later.

what do you mean by this?

We need i18n_dir & default_locale in ReactOnRails configuration. Currently, I use react_on_rails from my repository, and this will be fixed when react_on_rails/pull/642 is merged. shakacode/react_on_rails#642

Rake task should go with these and many tests needed for code inside the rake task. Create a new module or class with the logic. Rake tasks should be tiny.

We'll want to run this rake task during pre-compile. This will have to run before the webpack processes.

Another issue is that developers need to know to run this once and any time that the localization files changes. I'm not sure how best to handle this. I guess for development, it's OK if the Rails server builds this file on startup if needed. We have code in the test helper to run a task if required

https://github.com/shakacode/react_on_rails/blob/master/lib/react_on_rails/test_helper.rb#L53

We can do that for the localization files as well.

Thinking more about this, we need the localization files created for testing as well.

Hmmm....

It will be nice to make this super smooth, like we did for the dependency of tests on the JS files.


Reviewed 19 of 21 files at r4.
Review status: all files reviewed at latest revision, 16 unresolved discussions, some commit checks broke.


Gemfile.lock, line 12 at r4 (raw file):

      foreman
      rails (>= 3.2)
      rainbow (~> 2.1)

I'll merge this in for a release before merging this PR!


client/.eslintignore, line 4 at r4 (raw file):


app/libs/i18n/translations.js
app/libs/i18n/default.js

missing new line


client/app/bundles/comments/startup/clientRegistration.jsx, line 11 at r4 (raw file):

import { InitI18nLocale } from 'libs/i18n/i18nHelper';

InitI18nLocale();

You can have this init in the i18nHelper and only run init once. Save some value to check if this has been run.

Then you don't don't need to run the init here.

Another option would be to make this a webpack entry point. However, I think listing all the main entry points in this one file is best.


client/app/libs/i18n/i18nHelper.jsx, line 12 at r4 (raw file):

  addLocaleData([...en, ...de, ...ja, ...zh]);
};

We can run this here, and check that we only run this once.


lib/tasks/i18n.rake, line 3 at r4 (raw file):

require "erb"

namespace :i18n do

we should aim to put this into React on Rails


lib/tasks/i18n.rake, line 6 at r4 (raw file):

  desc "Convert rails locales to js files for React.js."
  task to_js: :environment do
    @translations, @defaults = translations

where is translations defined


lib/tasks/i18n.rake, line 13 at r4 (raw file):

  end

  def create_js_file(template, path)

what is the effect of putting these methods in the namespace block?


lib/tasks/i18n.rake, line 31 at r4 (raw file):

    end
    return translations.to_json, defaults.to_json
  end

all this logic should go into it's own module with tests


lib/tasks/i18n.rake, line 75 at r4 (raw file):

  def default_i18n_dir
    Rails.root.join("client", "app", "libs", "i18n")

this can go into the config


lib/tasks/i18n.rake, line 83 at r4 (raw file):

  def template_default_js
%q(import { defineMessages } from 'react-intl';

instead of

%q( blah 
blah
)

use a

<<JS
blah
blah
JS

lib/tasks/i18n.rake, line 92 at r4 (raw file):

)
  end
end

missing new line


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

@justin808

move i18n-js to speed up development. If it is needed, we can add it back later.

Before, the PR contained two different approaches using i18n-js gem & react-intl in different commits, but it took time to maintain both of them. Therefore, I focus only on react-intl in this PR now, and remove i18n-js gem commits. In the future, if someone wants to use i18n-js gem, we can add descriptions in a new PR.

As you suggested, I will move Rake task to react_on_rails gem, and create a module for related methods.
Meanwhile, this task will be added to initialize process when developers want to start server. This can make sure translations is up-to-dated.

Thanks for great feedbacks. Really learn a lot from your suggestions.


Review status: all files reviewed at latest revision, 16 unresolved discussions, some commit checks broke.


client/app/bundles/comments/components/CommentBox/CommentBox.jsx, line 44 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

are we losing the Loading... indicator? this should only show when a remote call is happening.

Done.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks broke.


Gemfile, line 41 at r10 (raw file):

Previously, justin808 (Justin Gordon) wrote…

remove

and let's update to the current version

done


Gemfile.lock, line 12 at r10 (raw file):

Previously, justin808 (Justin Gordon) wrote…

remove

done


Procfile.static.trace, line 5 at r10 (raw file):

Previously, justin808 (Justin Gordon) wrote…

we have a pre:build:client => still need the rake task here?

we have prebuild:client for build:client in client/package,json, but this line is build:dev:client.

We need another prebuild:dev:client for build:dev:client.
I did this, but it was suggested to run the task in procfile.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

+1 for pre


Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks broke.


Gemfile.lock, line 12 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I'll merge this in for a release before merging this PR!

Set gemfile.lock back to the original one.
This will be updated when react_on_rails updated.


client/.eslintignore, line 4 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I mentioned some other computed files. We may need to ignore those with a wildcard.

Added them to .eslintignore


client/app/libs/i18n/default.js, line 5 at r5 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@JasonYCHuang It seems this file is a generated file and should be excluded from the PR.

Are we sure that the default build script for deployment on heroku will create this generated file?

In general, we should always never commit generated files, as they cause tons of noise in PR diffs.

done


client/app/libs/i18n/i18nHelper.jsx, line 12 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@JasonYCHuang Just checking that we're not committing an empty file.

done


client/app/libs/i18n/translations.js, line 1 at r5 (raw file):

Previously, justin808 (Justin Gordon) wrote…

This file should also be excluded?

done


config/initializers/assets.rb, line 20 at r1 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@JasonYCHuang Why was this removed?

done


lib/tasks/i18n.rake, line 3 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

we should aim to put this into React on Rails

put this inside the React on Rails source code


lib/tasks/i18n.rake, line 6 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

where is translations defined

put this inside the React on Rails source code as a rake task


lib/tasks/i18n.rake, line 13 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

what is the effect of putting these methods in the namespace block?

done


lib/tasks/i18n.rake, line 31 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

all this logic should go into it's own module with tests

done


lib/tasks/i18n.rake, line 75 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

this can go into the config

done


lib/tasks/i18n.rake, line 83 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

instead of

%q( blah 
blah
)

use a

<<JS
blah
blah
JS

done


lib/tasks/i18n.rake, line 92 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

missing new line

done


public/javascripts/i18n.js, line 1 at r1 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@JasonYCHuang Should we put this inside the React on Rails source code? Where did this file come from? Rails?

put this inside the React on Rails source code.


Comments from Reviewable

@justin808
Copy link
Member

We would do it here for testing:

https://github.com/shakacode/react_on_rails/blob/master/lib/react_on_rails/test_helper/webpack_assets_compiler.rb#L8

# You can replace this implementation with your own for use by the
# ReactOnRails::TestHelper.ensure_assets_compiled helper
module ReactOnRails
  module TestHelper
    class WebpackAssetsCompiler
      def compile_assets
        puts "\nBuilding Webpack assets..."

        build_output = `cd client && #{ReactOnRails.configuration.npm_build_test_command}`

        raise "Error in building assets!\n#{build_output}" unless Utils.last_process_completed_successfully?

        puts "Completed building Webpack assets."
      end
    end
  end
end

And here for production: https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake#L53

# Sprockets independent tasks
namespace :react_on_rails do
  namespace :assets do
    desc <<-DESC
Compile assets with webpack
Uses command defined with ReactOnRails.configuration.npm_build_production_command
sh "cd client && `ReactOnRails.configuration.npm_build_production_command`"
    DESC
    task webpack: :environment do
      if ReactOnRails.configuration.npm_build_production_command.present?
        sh "cd client && #{ReactOnRails.configuration.npm_build_production_command}"
      end
    end
  end
end
``

Note, I just opened up a bug on the production tasks: https://github.com/shakacode/react_on_rails/issues/733

Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks broke.


Comments from Reviewable

@JasonYCHuang
Copy link
Contributor Author

For test, we still can not ensure js locale files are generated before npm build in the following line.
https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.travis.yml#L32

Another question is: should we call the rake task in different places, and make it scattered in 3 files?
test -> pre-hook in package.json
dev -> procfile
production -> https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake#L53


Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks broke.


Comments from Reviewable

@justin808
Copy link
Member

For test, we still can not ensure js locale files are generated before npm build in the following line.
https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.travis.yml#L32

We can try to remove that line actually...let's see.

Another question is: should we call the rake task in different places, and make it scattered in 3 files?
test -> pre-hook in package.json
won't need this one per changes to automatically running this.

dev ->procfile

Yes

production -> https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake#L53
This will be done automatically.

@justin808
Copy link
Member

This looks good. We'll have to try this out after I cut the new release. Just one small change to add regarding testing. See the other PR.


Reviewed 4 of 4 files at r11.
Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks failed.


Comments from Reviewable

@JasonYCHuang JasonYCHuang force-pushed the i18n branch 2 times, most recently from 52ae6f1 to dc9c8bb Compare March 1, 2017 10:02
@justin808
Copy link
Member

Please update to React on Rails 6.7.0 and I'll merge this.

@justin808
Copy link
Member

Actually,please use 6.7.1.

@justin808
Copy link
Member

Reviewed 3 of 3 files at r12.
Review status: all files reviewed at latest revision, 19 unresolved discussions, some commit checks failed.


.travis.yml, line 33 at r12 (raw file):

  - npm install
  - rake db:setup
  - npm run build:client && npm run build:server

we should run the locales before this...

but I think we can probably just remove this line


Comments from Reviewable

@justin808
Copy link
Member

Travis failure:

RESTART_PHANTOMJS = 
Capybara using driver: selenium_firefox
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 11449
Edit a comment
  from classic page
    when edit is submitted with blank fields
ERROR when compiling base_js_code! See file tmp/base_js_code.js to correlate line numbers of error. Error is
Error: Cannot find module "libs/i18n/default"
webpackMissingModule ((execjs):39338:81)
Object.(execjs) (:39338:175)
__webpack_require__ ((execjs):55:30)
Object.(execjs) (:34317:21)
__webpack_require__ ((execjs):55:30)
Object.(execjs) (:34195:20)
__webpack_require__ ((execjs):55:30)
Object.(execjs) (:34059:23)
Object.(execjs) (:34136:31)
__webpack_require__ ((execjs):55:30)
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:167:in `eval_unsafe'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:167:in `block (2 levels) in eval'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:217:in `timeout'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:166:in `block in eval'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:63:in `block in with_lock'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:63:in `synchronize'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:63:in `with_lock'
/home/travis/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.7/lib/mini_racer.rb:164:in `eval'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:10:in `block in initialize'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:66:in `translate'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/mini_racer_runtime.rb:9:in `initialize'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `new'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `compile'
/home/travis/.rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/module.rb:27:in `compile'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/lib/react_on_rails/server_rendering_pool/exec.rb:91:in `create_js_context'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/lib/react_on_rails/server_rendering_pool/exec.rb:10:in `block in reset_pool'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:170:in `try_create'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:82:in `block (2 levels) in pop'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:78:in `loop'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:78:in `block in pop'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:77:in `synchronize'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool/timed_stack.rb:77:in `pop'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool.rb:89:in `checkout'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool.rb:61:in `block in with'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `handle_interrupt'
/home/travis/.rvm/gems/ruby-2.3.1/gems/connection_pool-2.2.1/lib/connection_pool.rb:60:in `with'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/lib/react_on_rails/server_rendering_pool/exec.rb:72:in `eval_js'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/lib/react_on_rails/server_rendering_pool/exec.rb:36:in `server_render_js_with_console_logging'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/lib/react_on_rails/server_rendering_pool.rb:21:in `method_missing'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/app/helpers/react_on_rails_helper.rb:305:in `server_rendered_react_component_html'
/home/travis/.rvm/gems/ruby-2.3.1/gems/react_on_rails-6.7.1/app/helpers/react_on_rails_helper.rb:115:in `react_component'
/home/travis/build/shakacode/react-webpack-rails-tutorial/app/views/layouts/application.html.erb:24:in `_app_views_layouts_application_html_erb__4530883444687778251_70170606158920'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/template.rb:159:in `block in render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/notifications.rb:166:in `instrument'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/template.rb:354:in `instrument'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/template.rb:157:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/renderer/renderer.rb:23:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/rendering.rb:103:in `_render_template'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/rendering.rb:83:in `render_to_body'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/abstract_controller/rendering.rb:26:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/rendering.rb:36:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/implicit_render.rb:36:in `default_render'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/abstract_controller/base.rb:188:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:126:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:455:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/rescue.rb:20:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/notifications.rb:164:in `instrument'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/abstract_controller/base.rb:126:in `process'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionview-5.0.1/lib/action_view/rendering.rb:30:in `process'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal.rb:190:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_controller/metal.rb:262:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/journey/router.rb:39:in `block in serve'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/journey/router.rb:26:in `each'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/journey/router.rb:26:in `serve'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/routing/route_set.rb:725:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/conditional_get.rb:25:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/rack/logger.rb:36:in `call_app'
/home/travis/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:in `block in call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:in `block in tagged'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:in `tagged'
/home/travis/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/railties-5.0.1/lib/rails/engine.rb:522:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/capybara-2.7.1/lib/capybara/server.rb:43:in `call'
/home/travis/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/handler/webrick.rb:86:in `service'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
react_renderer.rb: 92
wrote file tmp/base_js_code.js
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

@JasonYCHuang JasonYCHuang force-pushed the i18n branch 2 times, most recently from 8ae7224 to e5ed7a7 Compare March 2, 2017 08:26
@@ -29,7 +29,6 @@ install:
- npm install npm@latest -g
- npm --version
- npm install
- npm run build:client && npm run build:server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rake locales
npm run build:test
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@JasonYCHuang JasonYCHuang force-pushed the i18n branch 5 times, most recently from 2c0b0f6 to b134b0a Compare March 2, 2017 09:30
@justin808
Copy link
Member

Just need to DRY up line from package.json and client/package.json


Reviewed 2 of 2 files at r13.
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


package.json, line 21 at r13 (raw file):

    "build:client": "(cd client && npm run build:client --silent)",
    "build:server": "(cd client && npm run build:server --silent)",
    "build:test": "npm run build:client && npm run build:server",

We really don't need this duplicated scripts here... There is already a build:test in the client/package.json. Travis can run the command with the cd.


Comments from Reviewable

@justin808
Copy link
Member

Reviewed 2 of 2 files at r14.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


Comments from Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants