# $lang

`evtLang` enable you to  switch the language without using `useLang` that can only be used in a react component. &#x20;

```tsx
import { $lang } from "i18n";

setTimeout(
    ()=> {
        console.log(`The app is currently in ${evtLang.state}`);
        console.log("We switch to fr now!");
        //This will trigger components to re-render.
        $lang.current= "fr";
    },
    30_000
);
```

Have a global callback that is invoked whenever the language is changed.

```typescript
import { $lang } from "i18n";

evtLang
    .subscribe(lang=> console.log(`The app has just beed switched to ${lang}`));

```


---

# 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://docs.i18nifty.dev/api-reference/usdlang.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.
