Based on and extension of ngx-translate. This is basically a simplified version of localize-router. If you are already using localize-router you don't need this extension. This extension is aimed only to facilitate language cache with ngx-translate.
|Angular version||Integration branch||Library version|
|8 and below||angular1-8||^0.0.0|
To install this library, run:
$ npm install ngx-translate-cache --save
To initialize ngx-translate you usually do
To initialize ngx-translate with ngx-translate-cache
init method will subscribe to
translateService.onLangChange event and update the cached language accordingly.
It also instruct ngx-translate to use the previous cached language if defined, or the browser current language if defined.
The order of precedence is as described below:
1. Cached language. 2. Current language of the browser. 3. Default language (language used as a fallback for *ngx-translate*).
You can also define the cache mechanism used (
Cookie), key used to store cached value and
cookie duration (defined in hours).
MIT © Jaime