Quick Start
Setup an app with Qwik Speak
npm install qwik-speak --save-devVite plugin
Add Qwik Speak Inline Vite plugin in vite.config.ts:
import { qwikSpeakInline } from 'qwik-speak/inline';
export default defineConfig(() => {
return {
plugins: [
qwikCity(),
qwikVite(),
qwikSpeakInline({
supportedLangs: ['en-US', 'it-IT'],
defaultLang: 'en-US',
assetsPath: 'i18n'
}),
tsconfigPaths(),
],
};
});Configuration
Let's create speak-config.ts and speak-functions.ts files in src folder:
src/speak-config.ts
src/speak-functions.ts
loadTranslation$is a customizable QRL function: you can load the translation files in the way you prefer
For more details, see Translation functions
Add useQwikSpeak provider in root.tsx and pass it the configuration and the translation functions:
src/root.tsx
Resolve locale
Create plugin.ts in the root of the src/routes directory:
src/routes/plugin.ts
We're on the server here, and you can get the language from
acceptLanguage, a cookie, or a URL parameter, as you like. But is mandatory to set the Qwik locale
Set the base URL for loading the chunks in the browser in entry.ssr.tsx file:
Tutorials
Last updated