0.0.8 • Published 2 years ago

backend-error-translations v0.0.8

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
2 years ago

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
0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago