Go to file
Ahmad Amireh d87a02825a canvas_i18nliner: implement ESM extractor
refs FOO-2696
flag = none

this new extractor is tailored for ES modules away from the previous AMD
implementation. It will be put to use once we add support for the
useScope interface in @canvas/i18n and adjust webpack/source files to
use it.

This is how i18n extraction works for ESM:

(1) import the "useScope" function from @canvas/i18n

    import { useScope } from '@canvas/i18n'
    import { useScope as useI18nScope } from '@canvas/i18n' // ALSO OK

(2) use that function to define your I18n receiver and supply a scope:

    const I18n = useScope('foo')

(3) proceed to call I18n.t or I18n.translate as usual:

    I18n.t('my_key', 'Hello') // => foo.my_key

the implementation required an upstream change to i18nliner-js; see
4040b1c979

~ test plan ~
  ---- ----

- read through the extractor code and rely on the tests since it's not
  wired yet

Change-Id: I5c1ff0c23983c0e61a649c9fb3f4673724d6e468
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286652
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2022-03-10 19:44:08 +00:00
.github update github pr auto-assignees 2020-09-24 20:00:41 +00:00
.storybook babel independence(4): storybook 2022-02-09 18:17:12 +00:00
.vscode Add configurations to enable remote IDE debugging with rdebug-ide 2021-09-16 18:33:11 +00:00
Gemfile.d bump switchman to 3.x 2022-03-10 13:04:53 +00:00
app explain Mention's reliance on ff 2022-03-10 19:16:34 +00:00
bin fix bin/rubocop to work when pwd != rails root 2021-10-19 22:40:09 +00:00
build Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
config update ErrorCollection shim for Rails 6.1 2022-03-10 14:46:22 +00:00
db/migrate Stop leaking siteadmin ids from spec setup 2022-02-25 23:11:11 +00:00
doc Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
docker-compose Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
engines RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
gems canvas_i18nliner: implement ESM extractor 2022-03-10 19:44:08 +00:00
hooks allow skipping pre-commit hook 2022-03-09 17:32:21 +00:00
jest expect correct prop type for CancelAttemptButton 2022-03-04 16:44:52 +00:00
lib Cache dynamic settings in request cache 2022-03-07 22:38:17 +00:00
log Update parallel_runtime_rspec.log from build 264 2021-10-25 16:59:25 +00:00
packages Remove 'instructure-embeds' unused plugin 2022-03-10 18:16:28 +00:00
public Commit proper core_en translation file 2022-02-28 21:47:21 +00:00
script Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
spec spec: clean up planner test flakiness 2022-03-10 19:40:06 +00:00
tmp Alpine canvas-lms based image 2020-07-15 17:21:56 +00:00
ui don't clobber new quizzes submissions in SG 2022-03-10 18:07:50 +00:00
ui-build use per-language instead of per-scope translation files 2022-02-18 00:10:23 +00:00
.codeclimate.yml disable ESLint in code climate 2017-02-14 17:47:39 +00:00
.dive-ci Spec: Add dive build 2020-03-26 14:52:06 +00:00
.dockerignore modernize canvas_quizzes 2021-01-14 22:45:10 +00:00
.editorconfig
.eslintignore rename frontend_build -> ui-build 2021-10-21 19:13:02 +00:00
.eslintrc.js ignore package translations in jest 2022-03-04 15:39:06 +00:00
.git-blame-ignore-revs rubocop: add .git-blame-ignore-revs 2021-11-29 20:56:29 +00:00
.gitignore update .gitignore 2022-03-05 01:37:33 +00:00
.gitmessage prepend some blank lines to .gitmessage 2019-08-09 16:12:53 +00:00
.groovylintrc.json fix linter rules 2021-05-19 15:43:33 +00:00
.i18nignore Don't try to extract translations from vendor 2022-03-03 17:48:51 +00:00
.i18nrc rename some things 2021-04-06 01:12:49 +00:00
.lintstagedrc.js Initial pace plans import 2021-09-01 19:58:33 +00:00
.npmrc
.nvmrc upgrade to node14 2021-01-27 15:33:52 +00:00
.prettierrc restore prettier rules to match pre-2.0 defaults 2021-02-09 17:03:14 +00:00
.rspec spec: automatically require spec_helper 2021-10-26 17:39:19 +00:00
.rubocop.yml rubocop: reconfigure Style/SoleNestedConditional 2022-01-10 23:36:08 +00:00
.sentryignore Add support for uploading JS sources and maps to Sentry 2022-02-18 22:33:59 +00:00
.stylelintrc modernize canvas_quizzes 2021-01-14 22:45:10 +00:00
.travis.yml
CONTRIBUTING.md Remove more freenode references 2021-06-02 16:18:53 +00:00
COPYRIGHT
Dockerfile Allow using rails 6.1 in jenkins 2022-02-16 21:49:00 +00:00
Dockerfile.githook Add precommit hook for auto fixing files 2018-11-27 21:07:31 +00:00
Dockerfile.jenkins Allow using rails 6.1 in jenkins 2022-02-16 21:49:00 +00:00
Dockerfile.jenkins-cache support pinning commonly modified gems to specific versions 2022-03-08 17:33:30 +00:00
Dockerfile.jenkins.final simplify Dockerfile template generation 2020-12-10 17:28:58 +00:00
Dockerfile.jenkins.karma-builder Properly support ruby 2.7 2021-06-11 21:06:37 +00:00
Dockerfile.jenkins.karma-runner remove translations/_core_en.js in production try 2 2022-02-18 00:08:38 +00:00
Dockerfile.jenkins.linters-final remove need to mount .git directory as volume for Linters 2021-05-10 18:57:42 +00:00
Dockerfile.jenkins.linters-runner stop using buildkit for linters image 2021-04-12 19:19:32 +00:00
Dockerfile.jenkins.ruby-runner purge pulsar from canvas 2022-01-03 20:37:22 +00:00
Dockerfile.jenkins.webpack-builder split yarn from webpack-builder into yarn-runner 2020-12-14 18:49:51 +00:00
Dockerfile.jenkins.webpack-cache use _core_en as en translations for pre-merge build 2022-02-18 02:06:59 +00:00
Dockerfile.jenkins.yarn-runner upgrade & dedupe node packages 2021-06-21 19:46:52 +00:00
Dockerfile.package-translations Update commitTranslations (properly this time) 2022-01-31 20:52:48 +00:00
Gemfile RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
Jenkinsfile start saving master karma image during main build 2022-03-09 15:59:23 +00:00
Jenkinsfile.axe Increment Jenkinsfile.axe RSPEC_PROCESSES to 6 2021-11-30 07:10:28 +00:00
Jenkinsfile.cassandra fix docker sync job 2021-10-01 15:11:55 +00:00
Jenkinsfile.contract-tests convert contract tests to using docker bridge network 2021-06-15 16:37:49 +00:00
Jenkinsfile.coverage Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
Jenkinsfile.coverage-js allow canvas javascript coverage report to run outside of main build 2022-03-10 14:52:42 +00:00
Jenkinsfile.crystalball Enable all rspec tests to generate crystalball map coverage 2022-02-01 17:23:26 +00:00
Jenkinsfile.dive fix jenkins file linter issues autofixable 2021-05-18 16:48:15 +00:00
Jenkinsfile.docker-smoke Revert "asset install in Dockerfile" 2021-06-29 13:36:09 +00:00
Jenkinsfile.docker-sync remove selenium from Jenkinsfile.docker-sync 2022-02-11 19:10:47 +00:00
Jenkinsfile.dynamodb fix docker sync job 2021-10-01 15:11:55 +00:00
Jenkinsfile.js remove translations/_core_en.js in production try 2 2022-02-18 00:08:38 +00:00
Jenkinsfile.master-bouncer-check-all fix docker sync job 2021-10-01 15:11:55 +00:00
Jenkinsfile.package-translations More translations build improvements 2021-06-30 15:32:09 +00:00
Jenkinsfile.parallel_logs fix jenkins file linter issues autofixable 2021-05-18 16:48:15 +00:00
Jenkinsfile.postgres update copyright disclaimer 2021-10-01 15:44:27 +00:00
Jenkinsfile.redis improve readability jenkins redis 2021-11-18 20:17:08 +00:00
Jenkinsfile.rspecq Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
Jenkinsfile.selenium-chrome fix docker sync job 2021-10-01 15:11:55 +00:00
Jenkinsfile.selenium.flakey_spec_catcher Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
Jenkinsfile.selenium.performance.chrome Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
Jenkinsfile.test-subbuild fix jenkins file linter issues autofixable 2021-05-18 16:48:15 +00:00
Jenkinsfile.vendored-gems purge pulsar from canvas 2022-01-03 20:37:22 +00:00
Jenkinsfile.xbrowser fix docker sync job 2021-10-01 15:11:55 +00:00
LICENSE
README.md Update README.md since Canvas is still modern 2016-12-15 03:18:28 +00:00
Rakefile RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
babel.config.js Ensure plugin-proposal-private-methods is loose 2021-11-08 20:22:57 +00:00
bower.json Move k5uplodaer to /packages 2019-05-10 18:30:51 +00:00
code_of_conduct.md
config.ru RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation 2021-11-25 14:03:06 +00:00
docker-compose.new-jenkins-flakey-spec-catcher.yml update fsc to go into the plugin directory to do tests 2020-06-17 14:58:09 +00:00
docker-compose.new-jenkins-js.yml remove translations/_core_en.js in production try 2 2022-02-18 00:08:38 +00:00
docker-compose.new-jenkins-package-translations.yml Create shared translation infrastructure for packages 2019-11-06 22:42:03 +00:00
docker-compose.new-jenkins-selenium.yml Upgrade to Selenium 4 2022-03-09 15:28:31 +00:00
docker-compose.new-jenkins.consumer.yml Bump rails 2021-12-23 15:26:13 +00:00
docker-compose.new-jenkins.vendored-gems.yml extract canvas::redis to canvas_cache 2021-03-02 14:38:55 +00:00
docker-compose.new-jenkins.yml Don't override CANVAS_RAILS6_0 in compose 2022-02-17 16:34:04 +00:00
docker-compose.spring.yml bring docker spring (without mutagen) up to date 2022-02-02 22:08:20 +00:00
docker-compose.yml Revert "asset install in Dockerfile" 2021-06-29 13:36:09 +00:00
gulpfile.js replace node-sass with dart-sass 2021-07-15 17:35:35 +00:00
issue_template.md Update community urls to reflect platform move 2020-08-12 20:17:02 +00:00
jest.config.js babel independence(3): jest 2022-02-09 17:20:24 +00:00
karma.conf.js re-enable canvas javascript coverage report 2022-02-28 15:36:57 +00:00
package.json Fix: unable to select DST start and end in calendar 2022-03-08 16:58:00 +00:00
tsconfig.json show TS where to find @canvas/ packages 2021-11-30 14:39:27 +00:00
webpack.config.js move crystalball webpack config into ui-build 2022-01-12 20:19:41 +00:00
yarn.lock canvas_i18nliner: implement ESM extractor 2022-03-10 19:44:08 +00:00

README.md

Canvas LMS

Canvas is a modern, open-source LMS developed and maintained by Instructure Inc. It is released under the AGPLv3 license for use by anyone interested in learning more about or using learning management systems.

Please see our main wiki page for more information

Installation

Detailed instructions for installation and configuration of Canvas are provided on our wiki.