# Preload Languages

This plugin enables the preloading of specified languages during periods of browser inactivity, leveraging the `requestIdleCallback` API for optimal performance.

## Installation

{% tabs %}
{% tab title="pnpm" %}

```bash
pnpm add @jsverse/transloco-preload-langs
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @jsverse/transloco-preload-langs
```

{% endtab %}

{% tab title="npm" %}

```bash
npm install @jsverse/transloco-preload-langs
```

{% endtab %}
{% endtabs %}

## Usage

{% tabs %}
{% tab title="Standalone" %}

```typescript
import { provideTranslocoPreloadLangs } from '@jsverse/transloco-preload-langs';

bootstrapApplication(AppComponent, {
  providers: [
    provideTranslocoPreloadLangs(['es', 'some-scope'])
  ],
});
```

{% endtab %}

{% tab title="NgModule" %}

```typescript
import { provideTranslocoPreloadLangs } from '@jsverse/transloco-preload-langs';

@NgModule({
  providers: [
    provideTranslocoPreloadLangs(['es', 'some-scope'])
  ]
  ...
})
export class TranslocoRootModule {}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jsverse.gitbook.io/transloco/plugins-and-extensions/preload-langs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
