New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ember-intl-errors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-intl-errors

This addon is ember-i18n-errors implementation for ember-intl.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

ember-intl-errors

This addon is ember-i18n-errors implementation for ember-intl.

It adds to your app a handy helper {{t-error error}} for translating errors in the context of the current route, but also takes advantage of Ember's route nesting to lookup translations in fallback on parent routes.

Installation

ember install ember-intl-errors

Usage

This is better explained with an example.

Let's say we have a validation error with the mandatory shape ({ attribute: 'email', message: 'invalid' }) and some nested routes with this structure:

parent
└── child
    └── grandchild

If within the grandchild.hbs template we use the helper {{t-error error}} the helper will try to find the most especific translation key for it based on the route hierarchy.

It follows a set of conventions very similar to how rails-i18n handles ActiveRecord errors.

The fallback chain for that error will be:

parent.child.grandchild.errors.email.invalid
parent.child.grandchild.errors.invalid
parent.child.errors.email.invalid
parent.child.errors.invalid
parent.errors.email.invalid
parent.errors.invalid
errors.email.invalid
errors.invalid

If none of those keys is defined in your translations the missing translation message will point you to the most specific translation: Missing translation: parent.child.grandchild.errors.email.invalid.

Contributing

Installation

  • git clone git@github.com:Mifrill/ember-intl-errors.git
  • cd ember-intl-errors
  • npm install

Linting

  • yarn lint:js
  • yarn lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.

Keywords

ember-intl

FAQs

Package last updated on 25 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts