Snyk has created this PR to upgrade i18n from 0.8.3 to 0.13.2.
:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
The recommended version is 12 versions ahead of your current version.
The recommended version was released 7 months ago, on 2020-08-21.
A preinstall script was added to force resolving specific versions of lodash and ajv. Those are sub-dependencies of zombie and its packages. Zombie is devDependency of i18n. But zombie still refers to older versions reported to vulnerable - so I decided to force fixed versions.
Of course that preinstall should count on any npm install i18n, it's renamed to force-resolutions so I can still resolve audit issues in dev while also supporting clean installs.
backward compatible default to singleton with const i18n = require('i18n')
create an instance of i18n by const i18n = new I18n()
Example:
/** * require I18n with capital I as constructor */const{ I18n }=require("i18n");/** * create a new instance with it's configuration */consti18n=newI18n({locales:['en','de'],directory: __dirname+'/locales'});
Thanks to @ einfallstoll i18n got much more developer friendly by adding two extra configuration options for working with translation files catalogs.
Added
Adds support for priming i18n with static catalogs (PR #432)
Adds support for custom callback/hook on missing translations thru missingKeyFn option ℗ #433 )
Examples
staticCatalog
Instead of letting i18n load translations from a given directory you may now pass your js object right on configuration, ie:
// DEMO: quick add yaml support on your ownconstyaml=require('js-yaml');constfs=require('fs');// configure and load translations from different locationsi18n.configure({staticCatalog: {de: require('../../locales/de.json'),en: require('../../locales/wired-en-filename.js'),fr: yaml.safeLoad(fs.readFileSync('../../locales/yaml/fr/server.yml','utf8'));},defaultLocale: 'de'})
This opens up for a ton of possible ways to handle translations in your very own desired way. But be warned: "Great power comes with great responsibility".
missingKeyFn
Want to get a warning on missing translations? Add missing translations with an indicator? Or even want to try an external service (like deepl.com) to provide an automated translated proposal of a missing phrase?
i18n.configure({missingKeyFn(locale,value){console.warn(`missing translation of "${value}" in [${locale}]!`)return`${value}-[${locale}]`;},defaultLocale: 'de'})
Snyk has created this PR to upgrade i18n from 0.8.3 to 0.13.2.
:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: i18n
Fixed
Fixed
Details
A preinstall script was added to force resolving specific versions of lodash and ajv. Those are sub-dependencies of zombie and its packages. Zombie is devDependency of i18n. But zombie still refers to older versions reported to vulnerable - so I decided to force fixed versions.
Of course that
preinstall
should count on anynpm install i18n
, it's renamed toforce-resolutions
so I can still resolve audit issues in dev while also supporting clean installs.now reads as
And doesn't get triggered by
npm install
.Added
retryInDefaultLocale
as proposed by PR #206header
as proposed by PRs #390 and #407Fixed
Changed
Added
const i18n = require('i18n')
const i18n = new I18n()
Example:
Fixed
Minimist is a sub-dependency of
mocha
andmessageformat
:Added
Fixed
Thanks to @ einfallstoll i18n got much more developer friendly by adding two extra configuration options for working with translation
filescatalogs.Added
missingKeyFn
option ℗ #433 )Examples
staticCatalog
Instead of letting i18n load translations from a given directory you may now pass your js object right on configuration, ie:
This opens up for a ton of possible ways to handle translations in your very own desired way. But be warned: "Great power comes with great responsibility".
missingKeyFn
Want to get a warning on missing translations? Add missing translations with an indicator? Or even want to try an external service (like deepl.com) to provide an automated translated proposal of a missing phrase?
Fixed
url
Added
number
orstring
) in__n()
(#305 )audit fix
Commit messages
Package name: i18n
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs