Closes: CORE-1756
Test plan:
* write `import(‘foo/bar’).then(bar => {})` in a file in app/jsx
* run `bundle exec rake i18n:check`
* it should work
* make sure the other i18n rake tasks still work like
`bundle exec rake i18n:generate_js`
Change-Id: I0966a5de4402232c57476249a3879b9ec1100992
Reviewed-on: https://gerrit.instructure.com/161632
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Run `script/nuke_node.sh` to clean everything up
Run `yarn install` it should install everything for everything
Run `yarn build` and `yarn test` they should work exactly as before
Change-Id: I11a27ff2d705c6cbb3b3f9029dd8b32138706146
Reviewed-on: https://gerrit.instructure.com/151356
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Test plan:
* i18n extraction/check should work still
Change-Id: I0056b0ca4fb725c68b9cf76bfddf37f9c151fe2b
Reviewed-on: https://gerrit.instructure.com/140504
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Regenerating this file to use the newest versions
Available to stay up-to-date
Test plan:
`yarn install` should work & automated tests should pass
Change-Id: I6d0bb216fb139a5ce0712a2d849f065f071d71d6
Reviewed-on: https://gerrit.instructure.com/130129
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
just use whatever canvas uses, so we get the new hotness. also stop using
old jasmine since it brings along coffeescript
also tweak gem_npm stuff so they can have legit devDependencies
Change-Id: I39e3c6b96903dbbc9c4c38a886431d9b6f292616
Reviewed-on: https://gerrit.instructure.com/106476
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
fixes: CNVS-34727
this will make webpack faster because it cuts down
the number of files it has to look for when
it looks a module up. right now, every time
someone asked for a app/jsx/whatever.jsx file
it had to do a stat for app/jsx/whatever.js first
and then look for app/jsx/whatever.jsx. it also
slows every lookup for handlebars/coffescript files
since it has to look for the jsx first
this was just the result of running this command:
find . -type f -name "*.jsx" | while read FNAME; do git mv "$FNAME" "${FNAME//.jsx/.js}"; done
test plan:
* automated specs should pass
* webpack build should run faster than the patchset
before this one
Change-Id: Ia15ded6dc2b09c10c4f9070edcee9305b5b429ad
Reviewed-on: https://gerrit.instructure.com/101005
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
also don't rely on plugin symlinks, as they are going away
test plan:
* be on canvas master
* have canvas analytics installed
* remove all compiled js in canvas and plugins
* run `rake i18n:generate` and save en.yml
* run `rake i18n:generate_js` and save the translations
* check out this commit
* run `rake i18n:generate` again and diff it:
* confirm you get its missing jsx strings
* confirm nothing else has changed
* run `rake i18n:generate_js` and diff the directory:
* confirm public/javascripts/translations/analytics.js has all the
missing strings
* confirm no other translation files have changed
Change-Id: I274aecba899367b8a26bc6f8791adbddd1cec06b
Reviewed-on: https://gerrit.instructure.com/103683
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
Closes: CNVS-35152
This changes all our tooling that used `npm` to
Run scripts to use `yarn`. `npm` will still work
for now but if you have yarn installed, it will use
that.
Cheat Sheet:
old command -> new command
npm install -> yarn install (or just `yarn`)
npm run webpack -> yarn run webpack
npm test -> yarn test
See more at https://yarnpkg.com
Test plan:
* all Jenkins builds should pass
* without yarn installed:
* run script/nuke_node.sh
* it should work and warn you about how `npm` is deprecated
* now install yarn, e.g.: `brew install yarn`
* run script/nuke_node.sh again
* it should work and you should see silly yarn emoji
in the output and it should be a lot faster
* the docker changes I made should work and docker should
build correctly and use yarn.
Change-Id: I4aa31eeae3ecc504634a7c72a1ea0d3396f445e3
Reviewed-on: https://gerrit.instructure.com/102969
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
also speed it up a hair by skipping coffeescript on non-i18ny files
test plan:
* i18n stuff should all pass jenkins
* g/100536 should be happier
Change-Id: I4a2dd70065dc80e82b062a93c662fc10c1b3cabf
Reviewed-on: https://gerrit.instructure.com/103460
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
speed up require_js and webpack builds. here's how:
* bump i18nliner
* it uses babel
* it is much faster
* tweak canvas_i18nliner to not need to precompile anything
* run i18n:generate_js without having to precompile anything
* webpack can avoid running js:generate altogether
test plan:
* tests pass
* i18n works as per usual under requirejs
* i18n works as per usual under webpack
* `rake i18n:generate`:
* builds identical yml before/after
* runs faster now
* works even if you nuke compiled coffee/jsx
* `rake i18n:generate_js`:
* builds identical translation files before/after
* runs faster now
* works even if you nuke compiled coffee/jsx
Change-Id: I2682e68ff87168d9f76e20deb93713aa9a50477a
Reviewed-on: https://gerrit.instructure.com/103285
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Fixes: CNVS-34067
Test plan:
* with webpack turned on and in prod mode
* run RAILS_ENV=production bundle exec rake canvas:compile_assets
* pick a different language on your user settings page (e.g.maori)
* go to /calendar
* the “week, Month, Agenda” buttons and everything
else on the page should be translated into your language
* go to other pages, e.g. /courses/x/assignments/new
* all of the strings on those pages should be translated too
(The broken behavior was that any strings that came from handlebars
Files would not be translated but ones coming from js, erb or
Coffeescript were)
Change-Id: I9a4b76e857b6c809b663d18abd7196ca10ef8564
Reviewed-on: https://gerrit.instructure.com/102534
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
it broke in the node upgrade (though fortunately not a feature we use),
and the tests were silently failing
test plan:
n/a, specs
Change-Id: Ib746b91e7500a31d8a8fb210af5afe8018c1dda3
Reviewed-on: https://gerrit.instructure.com/92764
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
closes: CNVS-29725
this gets everything working on node 6.
As far as our build process goes, it cannot support
running on both node 6 at the same time as 0.12
since our i18nliner handlebars stuff uses jsdom and
one version of it only works on node <4 and the
next only works on 4+.
But the stuff in the production dependencies in
package.json, aka the stuff that runs on the job
servers (brandable_css), can work on both. we just
need to run npm rebuild on the job servers if the stuff
that was npm installed into ./node_modules was compiled
against a different version of node. that is done here:
https://gerrit.instructure.com/81254
that commit needs to be committed to caturday before
we commit and deploy this to beta
as far as managing node, there are 2 "official"
ways that will make you life easier, you can either
just use docker or use nvm (https://github.com/creationix/nvm)
if you use nvm and if you use ZSH:
Put this into your $HOME/.zshrc to call nvm use automatically
whenever you enter a directory that contains an
.nvmrc file with a string telling nvm which node to use:
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
elif [[ $(nvm version) != $(nvm version default) ]]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
but however you do it, as long as you have node 6.2
installed it should work
test plan:
* install nvm
* check this patchset out
* run bundle exec rake canvas:compile_assets
* it should work
* use theme editor to preview a change to a theme
* it should work
Change-Id: I1cc9faed361938afc713c4b921042386b956db70
Reviewed-on: https://gerrit.instructure.com/80839
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
closes gh-870
Test Plan:
- Remove node_modules and do a fresh npm install
- Everything should work without a tough-cookie error
Change-Id: I0ac48acbe2709a902c630a0b473b4f925b48199b
Reviewed-on: https://gerrit.instructure.com/86049
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
fixes CNVS-28474
From what I could tell, none of the hbs templates were being passed the
`scope` value as part of the helper method `options.hash`, and that's
because we were not using the preprocesses that
PreProcessor.processStatement override via
frontend_build/i18nLinerHandelbars.js.
test plan:
- Load canvas using the Webpack build.
- Go into Calendar.
- Click on a day in the month and a Edit Event modal should pop up.
- Observe that the `Date:` labem is present, whereas it used to say
[object Object].
Change-Id: I8e077261379b43f5be27ab6544d9d05a47e97625
Reviewed-on: https://gerrit.instructure.com/81558
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Pedro Fajardo <pfajardo@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
rely on test_all_gems.sh to output header and trailer,
and use `set -e` in each test.sh to simplify passing
through errors
Change-Id: I3ba724ad2539ddfe31195394c43f646acfc73920
Reviewed-on: https://gerrit.instructure.com/70469
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
since other projects have been known to upgrade npm on a jenkins node in
the course of a build, affecting subsequent canvas builds ಠ_ಠ
test plan:
npm install should be happy on npm v3
Change-Id: I6767dac7dea7c8cfb4dfabbf94a29f6cccb00c15
Reviewed-on: https://gerrit.instructure.com/63708
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
ensure inferred keys are never scoped to the file
this fixes the current broken behavior:
{{#t}}...{{/t}}
scoped at extraction time
not scoped at runtime
{{t ...}} and I18n.t
not scoped at extraction time
scoped at runtime
ruby key inference already works correctly (never scoped to the file)
notes:
running i18n:generate will now put all inferred keys at the root level.
since no js/hbs inferred keys were actually resolving to their
translations, this won't break any currently working translations and
will fix a lot of stuff...
the inline hbs t and I18n.t calls will start working immediately (since it
was just a runtime scoping issue), the #t calls will automatically sort
themselves out with a transifex round trip (since they were scoped
incorrectly at extraction time). there are over 300 over the former and
about a dozen of the latter.
test plan:
1. confirm missing strings listed on ticket now show up. a good example of
this is the new course wizard; whereas before nothing was translated,
now everything is (apart from a few new strings that haven't made the
transifex round trip)
2. see all the new specs
3. also, try it out yourself. essentially:
1. run `rake i18n:generate`
2. find the string you want to verify, and put a corresponding value
in the right place in es.yml (or wherever) if there isn't already
one
3. run `rake canvas:compile_assets`
4. run canvas with `RAILS_LOAD_ALL_LOCALES=true USE_OPTIMIZED_JS=true`
5. switch to es (or whatever) and verify the translation is displayed
Change-Id: I0574b90acbdc4f6fda9c814a3607a9002c9e6a00
Reviewed-on: https://gerrit.instructure.com/47626
Tested-by: Jenkins
Reviewed-by: Jennifer Stern <jstern@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
extraction and runtime for ember handlebars
test plan:
1. verify string extraction:
1. `rake js:generate i18n:generate` before and after this commit
2. confirm `config/locales/generated/en.yml` is identical, except the
now you get a bunch of new ember strings
2. verify js translation file generation:
1. `rake i18n:generate_js` before and after this commit
2. confirm the files in public/javascripts/translations are identical,
plus a whole bunch of new ones for ember
3. confirm you can now use i18nliner-y features:
1. block helper with no key `{{#t}}hello world{{/t}}`
2. inline helper with no key `{{t "hello world"}}`
Change-Id: I7bca8aeba462e68f27973fa801e7f7dbc7b3c9ef
Reviewed-on: https://gerrit.instructure.com/43158
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
extraction and runtime for vanilla handlebars. ember will be part II
because its strings currently don't even get extracted on master
¯\_(ツ)_/¯
differences in generated yml:
1. `%h{...}` placeholders from hbs are just `%{...}`, since html-safety is
inferred at runtime without needing a placeholder hint (6 occcurrences)
2. inline `{{t ...}}` calls are now extracted (6 occurrences)
3. some trivial whitespace difference around some wrappers (2 occurrences)
4. html-entities are correctly converted into unicode equivalents, e.g.
`Move To…` -> `Move To…` (1 occurrence)
test plan:
1. verify string extraction:
1. `rake js:generate i18n:generate` before and after this commit
2. confirm `config/locales/generated/en.yml` is identical, except the
differences listed above
2. verify js translation file generation:
1. `rake i18n:generate_js` before and after this commit
2. confirm the files in public/javascripts/translations are identical
3. verify hbs translation keys/scope behavior at runtime:
1. run canvas w/ RAILS_LOAD_ALL_LOCALES=true and optimized js
2. use canvas in spanish
3. confirm that todo está bien
4. confirm you can now use i18nliner-y features:
1. block helper with no key `{{#t}}hello world{{/t}}`
2. inline helper with no key `{{t "hello world"}}`
Change-Id: Ic2a2c5cf102ca482919cbb91ac1c154467029685
Reviewed-on: https://gerrit.instructure.com/42942
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
this swaps out our "parsing" with i18nliner-js
also remove localization abilities of I18n.beforeLabel, since it's not
worth the trouble to support. it can still be called to format a string.
notable changes/fixes in generated yml:
1. client_apps are picked up by i18n:rake so they'll get translated...
due to the old short-circuiting logic (`rc = rc && ...`), it would
stop processing scripts within a particular file after the first one
it found without an I18n.t
2. we no longer incorrectly double-escape special chars in our js strings
(e.g. newlines are actually newlines, not a literal "\n")
test plan:
1. verify string extraction:
1. `rake js:generate i18n:generate` before and after this commit
2. confirm `config/locales/generated/en.yml` is identical, except the
notable changes/fixes listed above
2. verify js translation file generation:
1. `rake i18n:generate_js` before and after this commit
2. confirm the files in public/javascripts/translations are identical
3. verify client_app checker still works:
1. `cd client_apps/canvas_quiz_statistics/`
2. `grunt check_i18n`
Change-Id: Ic8ad058bee1c9476f42916f10b612c1c08863fe3
Reviewed-on: https://gerrit.instructure.com/42809
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>