Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update i18n to the latest version πŸš€ #50

Closed
wants to merge 2 commits into from

Conversation

greenkeeper[bot]
Copy link
Contributor

@greenkeeper greenkeeper bot commented May 24, 2020


🚨 Reminder! Less than one month left to migrate your repositories over to Snyk before Greenkeeper says goodbye on June 3rd! πŸ’œ πŸššπŸ’¨ πŸ’š

Find out how to migrate to Snyk at greenkeeper.io


The dependency i18n was updated from 0.9.1 to 0.10.0.

This version is not covered by your current version range.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.


Publisher: mashpie
License: MIT

Release Notes for 0.10.0 - Feature Release

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 own
const yaml = require('js-yaml');
const fs   = require('fs');

// configure and load translations from different locations
i18n.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'
})
Commits

The new version differs by 12 commits.

  • 3486c89 Merge branch 'release/0.10.0' into npm
  • 36e858e version bumb
  • 4339ad3 Added example to README
  • 1fa3689 Merge pull request #433 from einfallstoll/on-missing-key
  • b5cc7a8 Merge branch 'master' into on-missing-key
  • 8b80a3e prevent filesystem updates, etc. when using staticCatalog (#432)
  • 612bb5b add support for missing key function (fixes #333)
  • 8aa57b8 Merge pull request #432 from einfallstoll/static-catalog
  • be237b5 Update FUNDING.yml
  • 0e07333 add support for static catalog (fixes #262)
  • a1fa83b #376 - add notes & tests mustache with markup
  • 4fb18b6 Merge tag '0.9.1'

See the full diff


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper bot 🌴

@coveralls
Copy link

coveralls commented May 24, 2020

Pull Request Test Coverage Report for Build 340

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.394%

Totals Coverage Status
Change from base Build 322: 0.0%
Covered Lines: 92
Relevant Lines: 92

πŸ’› - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants