open-index/open-npm huggingface dataset:
npm package: @lokale/web
Description: Lokale for web
Author: Lokale
Latest version: 6.2.7

{% import "../../readmeMacros/macros.njk.md" as macros %}

{{ macros.header('Lokale JS Web', 'The base of Lokale JS integrations for Web platform', packageName) }}

## What is Lokale JS Web?
It's the core library of Lokale JS integrations containing the parts supporting the web platform.
For more information about Lokale JS integrations, visit the [docs]({{ macros.v5link() }}).

{{ macros.links() }}

{{ macros.installation('web') }}

## Usage

First, create a Lokale instance and run it.

```ts
import { Lokale, DevTools, FormatSimple } from "@lokale/web";

const tg = Lokale()
  .use(DevTools())
  .use(FormatSimple())
  .init({
    apiKey: "your_api_key",
    apiUrl: "https://api.lokale.fallback.in",
  })

tg.run();
```

Then, use it to translate your strings.

```ts
tg.onLangLoaded.subscribe(() => {
  document.title = tg.translate("hello_world");
});
```

{{ macros.why() }}

## Development
{{ macros.developmentInstallation() }}
{{ macros.developmentCore() }}

{{ macros.developmentTesting('/packages/core') }}

### End-to-end (e2e) testing

Each integration is end-to-end tested via cypress. The tests are defined in `/e2e/cypress/e2e` directory.

To run the e2e tests, simply run the following:
```
pnpm run e2e run <integration>
```
E.g.
```
pnpm run e2e run web
```

To open and play with e2e tests, run:
```
pnpm run e2e open <integration>
```

{{ macros.contributors() }}