You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now the library cache translations using a plain Javascript object (i.e in memory), it works but it can be problematic with large translation files.
We could add a cache option transmitted to the Polyglot constructor. If this cache option is a string it allows to use a pre-defined cacheManager, if this cache option is a function it defined a custom cacheManager.
Pre-defined cache managers could be :
MEMORY : Cache translations using a plain Javascript object
LOCAL_STORAGE : Cache translations using the Local Storage
SESSION_STORAGE : Cache translations using the Session Storage
INDEXED_DB : Cache translations using IndexedDb
WEB_SQL : Cache translations using Web SQL
Each pre-defined cache manager could also be configured using a Javascript object, for example.
For now the library cache translations using a plain Javascript object (i.e in memory), it works but it can be problematic with large translation files.
We could add a
cache
option transmitted to the Polyglot constructor. If this cache option is a string it allows to use a pre-definedcacheManager
, if this cache option is a function it defined a customcacheManager
.Pre-defined cache managers could be :
MEMORY
: Cache translations using a plain Javascript objectLOCAL_STORAGE
: Cache translations using the Local StorageSESSION_STORAGE
: Cache translations using the Session StorageINDEXED_DB
: Cache translations using IndexedDbWEB_SQL
: Cache translations using Web SQLEach pre-defined cache manager could also be configured using a Javascript object, for example.
Sample custom cache manager
The text was updated successfully, but these errors were encountered: