Bump i18n-js from 3.9.2 to 4.0.0

Bumps [i18n-js](https://github.com/fnando/i18n-js) from 3.9.2 to 4.0.0.
- [Release notes](https://github.com/fnando/i18n-js/releases)
- [Changelog](https://github.com/fnando/i18n-js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fnando/i18n-js/compare/v3.9.2...v4.0.0)

---
updated-dependencies:
- dependency-name: i18n-js
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2022-08-08 18:23:19 +00:00
committed by Sebastian Serth
parent ad5acd7f1b
commit 727f85841d
9 changed files with 70 additions and 7 deletions

View File

@ -14,7 +14,7 @@ gem 'faraday-net_http_persistent'
gem 'faye-websocket'
gem 'forgery'
gem 'highline'
gem 'i18n-js', '< 4.0.0'
gem 'i18n-js'
gem 'ims-lti', '< 2.0.0'
gem 'jbuilder'
gem 'json_schemer'

View File

@ -164,6 +164,7 @@ GEM
websocket-driver (>= 0.5.1)
ffi (1.15.5)
forgery (0.8.1)
glob (0.3.0)
globalid (1.0.0)
activesupport (>= 5.0)
haml (5.2.2)
@ -178,8 +179,9 @@ GEM
domain_name (~> 0.5)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
i18n-js (3.9.2)
i18n (>= 0.6.6)
i18n-js (4.0.0)
glob
i18n
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
@ -563,7 +565,7 @@ DEPENDENCIES
forgery
headless
highline
i18n-js (< 4.0.0)
i18n-js
ims-lti (< 2.0.0)
jbuilder
js-routes

View File

@ -14,8 +14,6 @@
//= require pagedown_bootstrap
//= require rails-timeago
//= require locales/jquery.timeago.de.js
//= require i18n
//= require i18n/translations
//
// lib/assets
//= require flash

View File

@ -40,6 +40,23 @@ import 'jquery-ui/themes/base/resizable.css'
import 'jquery-ui/themes/base/selectable.css'
import 'jquery-ui/themes/base/sortable.css'
// I18n locales
import { I18n } from "i18n-js";
import locales from "../../../tmp/locales.json";
// Fetch user locale from html#lang.
// This value is being set on `app/views/layouts/application.html.erb` and
// is inferred from `ACCEPT-LANGUAGE` header.
const userLocale = document.documentElement.lang;
export const i18n = new I18n();
i18n.store(locales);
i18n.defaultLocale = "en";
i18n.enableFallback = true;
i18n.locale = userLocale;
window.I18n = i18n;
// Routes
import * as Routes from 'routes.js.erb';
window.Routes = Routes;

8
config/i18n.yml Normal file
View File

@ -0,0 +1,8 @@
---
translations:
- file: tmp/locales.json
patterns:
- "*"
- "!*.activerecord"
- "!*.errors"
- "!*.number.nth"

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
Rails.application.config.after_initialize do
require 'i18n-js/listen'
# This will only run in development.
I18nJS.listen
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
task before_assets_precompile: :environment do
system('bundle exec i18n export')
end
# every time you execute 'rake assets:precompile'
# run 'before_assets_precompile' first
Rake::Task['assets:precompile'].enhance ['before_assets_precompile']
task before_assets_clobber: :environment do
system('rm -rf ./tmp/locales.json')
end
# every time you execute 'rake assets:precompile'
# run 'before_assets_precompile' first
Rake::Task['assets:clobber'].enhance ['before_assets_clobber']

View File

@ -9,6 +9,7 @@
"d3": "^7.6.1",
"d3-tip": "^0.9.1",
"highlight.js": "^11.5.1",
"i18n-js": "^4.0.2",
"jquery": "^3.6.0",
"jquery-ui": "^1.13.1",
"jquery-ujs": "^1.2.3",

View File

@ -1577,6 +1577,11 @@ big.js@^5.2.2:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
bignumber.js@*:
version "9.0.2"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.2.tgz#71c6c6bed38de64e24a65ebe16cfcf23ae693673"
integrity sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==
binary-extensions@^1.0.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65"
@ -3796,6 +3801,14 @@ https-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==
i18n-js@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/i18n-js/-/i18n-js-4.0.2.tgz#31a62520204e292675bd72e82abdfeeb9aed5f20"
integrity sha512-81geA9vPvWe4NI2uL8Ve+/2jM03Sj/IvGgFHPxij7DbSXbG3CfChRK1vBj2h2IRl6eVRZf3Eq4ug3PgeeWUUPA==
dependencies:
bignumber.js "*"
lodash "*"
iconv-lite@0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@ -4481,7 +4494,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.5:
lodash@*, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.5:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==