-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from robisim74/dev-inline-v3
Dev inline
- Loading branch information
Showing
87 changed files
with
5,001 additions
and
4,367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Lazy loading translation | ||
|
||
If you are developing a large app, you can consider using lazy loading translation: translations that are lazy loaded only when requested (when the user navigates to a specific section or page of the app): | ||
|
||
```mermaid | ||
C4Container | ||
Container_Boundary(a, "App") { | ||
Component(a0, "root", "useQwikSpeak", "Translations available in the whole app") | ||
Container_Boundary(b1, "Site") { | ||
Component(b10, "Page", "useSpeak", "Translations available in Page component") | ||
} | ||
Container_Boundary(b2, "Admin") { | ||
Component(b20, "layout", "useSpeak", "Translations available in child components") | ||
} | ||
} | ||
``` | ||
|
||
For lazy loading of files in a specific section, you need to add `useSpeak` to the layout: | ||
```tsx | ||
import { useSpeak } from 'qwik-speak'; | ||
|
||
export default component$(() => { | ||
useSpeak({assets:['admin'], runtimeAssets: ['runtimeAdmin']}); | ||
|
||
return ( | ||
<> | ||
<main> | ||
<Slot /> | ||
</main> | ||
</> | ||
); | ||
}); | ||
``` | ||
or in a specific page: | ||
```tsx | ||
export default component$(() => { | ||
useSpeak({runtimeAssets: ['runtimePage']}); | ||
|
||
return <Page />; | ||
}); | ||
``` | ||
> Note that you must create a component for the page, because Qwik renders components in isolation, and translations are only available in child components |
Oops, something went wrong.