1.26.0 • Published 6 months ago

globalfy-glossary v1.26.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
6 months ago

Here’s an updated version of your README that includes the basic usage examples for getException and getExceptionTranslation:


Globalfy Glossary

globalfy-glossary is a TypeScript library that provides translations and exception handling for the Globalfy platform.

Installation

To install the library, you can use npm or yarn:

npm install globalfy-glossary
# or
yarn add globalfy-glossary

Usage

Here’s how you can use the Messages, Exceptions, getException, and getExceptionTranslation from the library:

import {
  Exceptions,
  ExceptionCode,
  getException,
  getExceptionTranslation,
  Language,
  Messages,
} from 'globalfy-glossary';

// Using Messages and Exceptions
console.log(Messages.someMessage);
console.log(Exceptions.someException);

// Using getException
const exception = getException('API_ERROR');
console.log(exception);

// Using getExceptionTranslation
const translation = getExceptionTranslation('API_ERROR', Language.Pt);
console.log(translation);

// Using the ExceptionCode
getException(ExceptionCode.ActiveCompanyNotFound);
// or
getExceptionTranslation(ExceptionCode.ActiveCompanyNotFound, Language.Pt);

Replace someMessage and someException with the keys of the messages and exceptions you want to use. Replace 'API_ERROR' with the exception key you're working with and 'pt' with your preferred language (en, pt, or es).

Types

The library provides the following types:

  • Translations: An object with en, pt, and es properties, each of which is a string.
  • Message: An object with code, status, and translations properties. code and status are numbers, and translations is a Translations object.
  • Exception: Similar to Message, but used for exceptions.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

ISC


This update includes the examples for both getException and getExceptionTranslation functions, showing how to handle exceptions and retrieve translations.

1.18.0

7 months ago

1.16.0

8 months ago

1.21.0

7 months ago

1.25.0

6 months ago

1.23.0

7 months ago

1.15.0

8 months ago

1.19.0

7 months ago

1.17.0

8 months ago

1.22.0

7 months ago

1.20.0

7 months ago

1.24.1

7 months ago

1.26.0

6 months ago

1.24.0

7 months ago

1.14.0

9 months ago

1.13.0

9 months ago

1.12.0

9 months ago

1.9.0

10 months ago

1.8.0

10 months ago

1.11.0

9 months ago

1.10.0

10 months ago

1.2.0

12 months ago

1.1.9

1 year ago

1.1.8

1 year ago

1.7.0

11 months ago

1.6.0

11 months ago

1.5.0

12 months ago

1.4.0

12 months ago

1.3.0

12 months ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.13

1 year ago

1.1.19

1 year ago

1.1.22

12 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago