backend-error-translations
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

to use error-translations library:

  • run npm i backend-error-translations
  • import ErrorTranslationsModule to your @NgModule imports[] this should import it as follow: import { ErrorTranslationsModule } from "error-translations";
  • to use translateError pipe: <p [innerHTML]="errorKey | translateError:locale"></p>" make sure that locale is a valid Locale value that you can import from your component as well should be imported from: import { Locale } from "error-translations";
  • errorKey should be Uppercase, dot separated key path like 'INVALID.CREDENTIALS_PROVIDED', you can find locales files in langs/.json
  • to use humanize() function: inject ErrorTranslationsService also from error-translations and use the function as follow: .humanize(errorKey: string, locale: Locale) with the specified types

to add language support

  • add a json file in projects/error-translations/src/lib/translations like: fr.json
  • re-run the script npm run build:lib

to publish the library

  • npm run publish it builds the lib and publish its dist folder

Package Sidebar

Install

npm i backend-error-translations

Weekly Downloads

1

Version

0.0.8

License

ISC

Unpacked Size

80 kB

Total Files

22

Last publish

Collaborators

  • contactless.micetribe