# Qwik Speak and Adapters

> If you use Qwik-provided adapters for publishing your app, especially with *edge functions* or *static generation*, it is recommended to bundle the translation files (see [Translation functions](/qwik-speak/library/translation-functions.md))

If your production environment doesn't support *dynamic import*, you can import files directly:

```typescript
/**
 * Translation files are imported directly as string
 */
const translationData = import.meta.glob<Translation>('/i18n/**/*.json', { as: 'raw', eager: true });

const loadTranslation$: LoadTranslationFn = server$((lang: string, asset: string) =>
  JSON.parse(translationData[`/i18n/${lang}/${asset}.json`])
);
```

## Static Site Generation (SSG)

If you want to use Static Site Generation, you need to generate for each supported language an `index.html` of each page you will include in SSG.

### Get the code ready

* Bundle the translation files (see [Translation functions](/qwik-speak/library/translation-functions.md)) or provide a running server during the build if you are fetching the files
* Configure a localized router with a `lang` parameter
* Handle the dynamic `lang` parameter, adding the values it can take to each page included in SSG, e.g.:

*src/routes/\[...lang]/index.tsx*

```typescript
export const onStaticGenerate: StaticGenerateHandler = () => {
  return {
    params: config.supportedLocales.map(locale => {
      return { lang: locale.lang !== config.defaultLocale.lang ? locale.lang : '.' };
    })
  };
};
```

> See [Dynamic SSG routes](https://qwik.builder.io/docs/guides/static-site-generation/#dynamic-ssg-routes) in official Qwik docs for more details

### Building

```shell
npm run build
```

Inspect the `dist` folder: you should have for each language an `index.html` of each page you have included in SSG.


---

# 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://robisim74.gitbook.io/qwik-speak/library/adapters.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.
