Commit Graph

9 Commits

Author SHA1 Message Date
Aaron Ogata d3ba157e43 remove translations/_core_en.js in production try 2
refs FOO-2720
flag = none

Short version: the "_core_en.js" file is no longer loaded in production
as its contents have been merged (there) with the super "core.js" file,
which is targeted for removal later in this series.

Change-Id: I05eb76a2f1cac12b4ab953bad0ca5a49b6ffd37b

---

The problem as I understand it: there are certain phrases that are
marked as "core" because they are used by shared/logic code like
DateTime formatters and are pre-defined in config/locales.yml. These
phrases were being supplied in two distinct files:

- _core_en.js, which includes only the phrases for the "en" language
- _core.js, which includes the phrases for the rest of the supported
  locales

_core_en was split because it was deemed necessary to be loaded always,
regardless of the active locale, and that is - as it appears to me, at
least - because some code attempts to look up those phrases at the
time their modules are evaluated. This patch corrects those modules to
defer their lookups until the point where the translations are used,
and when the translations have become available -- just like the rest of
the codebase does.

But if this is true, this begs the question, how come those modules
weren't presenting bugs by using translations for "en" and not for the
target locale? My thinking is that it is only coincidental that they
weren't: should _any_ module that uses I18n be evaluated _before_ any of
those modules, the Webpack plugin will have already loaded the "core"
file, which includes the translations for those phrases in the target
locale. _core_en may not have been loaded by then, but that doesn't
matter because the resolver is gonna look for what's in _core first when
it's available, and it is.

---

What happens in this patch is a slight change to prepare for the full
removal of both _core and _core_en: _core_en is now loaded only in
builds that don't load actual translations because we need the default
values that that file provides. The alternative would've been to go to
each call-site that looks up the phrases provided in _core_en and have
them supply default values, but it's untenable at this point.

This is the list of call-sites and the phrases they look up:

    ui/features/calendar/jquery/index.js: time.formats.tiny_on_the_hour
    ui/features/quiz_statistics/util/parse_number.js: number.format.delimiter
    ui/features/quiz_statistics/util/parse_number.js: number.format.separator
    ui/shared/day-substitution/backbone/views/DaySubstitutionView.coffee: date.day_names
    ui/shared/syllabus/jquery/calendar_move.js: date.month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.formats.medium
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_month_names
    ui/shared/datetime/jquery/DatetimeField.js: date.day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.abbr_day_names
    ui/shared/datetime/jquery/DatetimeField.js: date.datepicker.column_headings
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.hour
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.minute
    ui/shared/datetime/react/components/render-datepicker-time.js: datepicker.titles.am_pm
    ui/shared/handlebars-helpers/dateSelect.js: date.order
    ui/shared/handlebars-helpers/dateSelect.js: date.*
    ui/shared/i18n/i18nObj.js: number.format
    ui/shared/i18n/numberHelper.js: number.format.delimiter
    ui/shared/i18n/numberHelper.js: number.format.separator

dateSelect.js is the gnarly one because it seems to be passing through
everything under date.* to God knows who.

The list above was generated with a command similar to this:

    grep -rnP "I18n.(t|lookup)\(['\"](date|datetime|number|support|time)\S" ui

---

~ test plan ~
  ~~~~ ~~~~

- you can still activate a different locale and use something like the
  datepicker to normal effect

[change-merged]
[build-registry-path=jenkins/canvas-lms/foo-2720-01]

Change-Id: Ifd5d2d888edc9b89a9930824f2c55fd9c275b03f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284102
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-02-18 00:08:38 +00:00
Aaron Ogata 7d73da5f3f disable translations for Jenkins build
refs DE-517

Disable locales on pre-merge Jenkins build in order to save ~25s on builds that require webpack to recompile. This also lets us clean up the code that builds the js-runner image. Pre-merge builds will still verify the i18n tasks in the Linters job, and post-merge builds will continue to build / run all tests using locales.

[build-registry-path=jenkins/canvas-lms/de-517]
[change-merged]

Change-Id: I8ded5d675b72d713738307403502f459adc79a73
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258197
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2021-02-08 16:03:06 +00:00
Aaron Ogata a8102ab205 cache JS runner image
refs DE-490

Change-Id: I83f15e273f0b6fa059ab259780db4f3ac026805f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257869
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
2021-02-03 19:30:30 +00:00
Ryan Norton 06c7dd9398 work around docker-compose network race condition
Sometimes docker-compose up can try to create 2 networks with the same name at exactly the same time, causing an error. Fix this by assigning a unique project name to each container, so that it creates differently named networks.

Change-Id: Ie25793a316f815db03bd834b6f8e4dcaeac8f024
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253588
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2020-12-01 19:05:22 +00:00
Aaron Ogata 5344111714 restructure JS jobs for ruby-runner change
refs DE-376

With the ruby-runner change that is coming, the final image will no longer include the node_modules/ assets, so we have to checkout the WEBPACK_BUILDER separately and copy in the source from the final PATCHSET_TAG.

Change-Id: Ic3c048500e00858bfa39244b308112cbc721783d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252666
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2020-11-17 19:25:41 +00:00
Aaron Ogata f6e7acb991 Revert "restructure JS jobs for ruby-runner change"
This reverts commit d893385149.

Reason for revert: broke Jenkins

Change-Id: Ic3fe2f4d4940cbad99ab6074741fa7b73ba774a0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252665
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Reviewed-by: Ryan Norton <rnorton@instructure.com>
Tested-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2020-11-17 17:05:11 +00:00
Aaron Ogata d893385149 restructure JS jobs for ruby-runner change
refs DE-376

With the ruby-runner change that is coming, the final image will no longer include the node_modules/ assets, so we have to checkout the WEBPACK_BUILDER separately and copy in the source from the final PATCHSET_TAG.

Change-Id: Ide3885f41d7ee21f4034331c204c2cafdc76aa28
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252922
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2020-11-17 15:33:33 +00:00
Clay Diffrient 41a0220079 Rename linters-and-js build to frontend
Change-Id: If43ab8c5b9fd291ae06bc1975f443cb6c3e0140e
Reviewed-on: https://gerrit.instructure.com/207991
Tested-by: Jenkins
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-09-05 20:15:10 +00:00
Clay Diffrient 8247f43008 Add linters to new Jenkins
This moves eslint, stylelint, and xsslint to be part of our
JS build pipeline.  It does not account for other linters that
are more general like tatl_tael linters and commit messages or
non-frontend language specific linters like rubocop.

Test Plan:
  - The linters-and-js build on New Jenkins should run and actually
    run the linters specified above.

closes COREFE-220

flag = none

Change-Id: I8f633caf9af025c83bbe68fbd1536276a838c159
Reviewed-on: https://gerrit.instructure.com/206106
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-09-03 19:18:30 +00:00