1.0.3 • Published 1 year ago

trans-cache v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

TransCache

TestsCoverageSecurity
CircleCICoverage StatusKnown Vulnerabilities

Purpose

Minimal translation cache module. It provides following functions:

  1. Initializes with target language (to use separate stores for each language)
  2. Allows fetching existing translation (or should return null)
  3. Allows saving new translations for future use

Usage

For usage example see index.js.

Internal details

The class is not optimized much.

To prevent re-reads, the class stores all translations in memory (per initialized instance, each with different language). This can result in a huge memory load, when pre-stored translations. Pre-stored translations can be pushed (on a new branch and PR, please) and will be therefore reviewed on each pull-request.

Expected use

Making a new translation:

  1. Fetch translation (returns null)
  2. Translate using DeepL or anything else (if no translation available)
  3. Store and return fetched translation

Fething existing translation:

  1. Fetch translation (reloads store and returns value for key from memory)

TODOs

  • Optimize: check translation in memory first; if not available: reload store and retry... return null on failure
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago