
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@ngneat/transloco-persist-translations
Advanced tools
This plugin provides the functionality of persisting translations to the provided storage.
npm install @ngneat/transloco-persist-translations
Import the TranslocoPersistTranslationsModule
module into the AppModule
, and provide the storage you would like to use:
import {
TranslocoPersistTranslationsModule,
PERSIST_TRANSLATIONS_STORAGE
} from '@ngneat/transloco-persist-translations';
import { HttpLoader } from './transloco.loader';
@NgModule({
imports: [
...TranslocoModule,
TranslocoPersistTranslationsModule.init({
loader: HttpLoader,
storage: {
provide: PERSIST_TRANSLATIONS_STORAGE,
useValue: localStorage
}
})
]
})
export class AppModule {}
You can also use an async storage. For example, let's install localForage and use IndexedDB
:
import {
TranslocoPersistTranslationsModule,
PERSIST_TRANSLATIONS_STORAGE
} from '@ngneat/transloco-persist-translations';
import { HttpLoader } from './transloco.loader';
import * as localForage from 'localforage';
localForage.config({
driver: localForage.INDEXEDDB,
name: 'Transloco',
storeName: 'translations'
});
@NgModule({
imports: [
...TranslocoModule,
TranslocoPersistTranslationsModule.init({
loader: HttpLoader,
storage: {
provide: PERSIST_TRANSLATIONS_STORAGE,
useValue: localForage
}
})
]
})
export class AppModule {}
TranslocoPersistTranslationsModule
can also receive the following configuration:
{
"ttl": 86400,
"storageKey": "yourKey"
}
ttl
: How long the cache should live in seconds.storageKey
: The key to be used to save the translations data.The storage cleanup is done automatically once the ttl
is passed, but it could also can be done manually by calling clearCache
method from the cache service:
import { TranslocoPersistTranslations } from '@ngneat/transloco-persist-translations';
export class AppComponent {
constructor(private loader: TranslocoPersistTranslations) {}
clearTranslationsCache() {
this.loader.clearCache();
}
}
FAQs
Transloco persist translations
The npm package @ngneat/transloco-persist-translations receives a total of 419 weekly downloads. As such, @ngneat/transloco-persist-translations popularity was classified as not popular.
We found that @ngneat/transloco-persist-translations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.