@intlayer/docs 7.3.11 → 7.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generated/docs.entry.cjs +19 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +19 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_nuxt.md +305 -421
- package/docs/ar/intlayer_with_react_router_v7.md +33 -4
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/ar/intlayer_with_tanstack.md +2 -12
- package/docs/ar/intlayer_with_vite+vue.md +1 -0
- package/docs/de/intlayer_with_nuxt.md +296 -394
- package/docs/de/intlayer_with_react_router_v7.md +33 -4
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +573 -0
- package/docs/de/intlayer_with_tanstack.md +1 -0
- package/docs/de/intlayer_with_vite+vue.md +1 -0
- package/docs/en/intlayer_with_nuxt.md +242 -321
- package/docs/en/intlayer_with_react_router_v7.md +24 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +570 -0
- package/docs/en/intlayer_with_tanstack.md +2 -12
- package/docs/en/intlayer_with_vite+vue.md +49 -48
- package/docs/en-GB/intlayer_with_nuxt.md +262 -358
- package/docs/en-GB/intlayer_with_react_router_v7.md +33 -4
- package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +513 -0
- package/docs/en-GB/intlayer_with_tanstack.md +2 -12
- package/docs/en-GB/intlayer_with_vite+vue.md +1 -0
- package/docs/es/intlayer_with_nuxt.md +284 -375
- package/docs/es/intlayer_with_react_router_v7.md +33 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +575 -0
- package/docs/es/intlayer_with_tanstack.md +1 -0
- package/docs/es/intlayer_with_vite+vue.md +1 -2
- package/docs/fr/intlayer_with_nuxt.md +288 -387
- package/docs/fr/intlayer_with_react_router_v7.md +34 -5
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/fr/intlayer_with_tanstack.md +1 -0
- package/docs/fr/intlayer_with_vite+vue.md +1 -0
- package/docs/hi/intlayer_with_nuxt.md +318 -434
- package/docs/hi/intlayer_with_react_router_v7.md +33 -4
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +518 -0
- package/docs/hi/intlayer_with_tanstack.md +2 -12
- package/docs/hi/intlayer_with_vite+vue.md +1 -0
- package/docs/id/intlayer_with_nuxt.md +275 -376
- package/docs/id/intlayer_with_react_router_v7.md +29 -4
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +521 -0
- package/docs/id/intlayer_with_tanstack.md +2 -12
- package/docs/id/intlayer_with_vite+vue.md +1 -0
- package/docs/it/intlayer_with_nuxt.md +312 -408
- package/docs/it/intlayer_with_react_router_v7.md +33 -4
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/it/intlayer_with_tanstack.md +1 -0
- package/docs/ja/intlayer_with_nuxt.md +319 -414
- package/docs/ja/intlayer_with_react_router_v7.md +33 -4
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ja/intlayer_with_tanstack.md +2 -12
- package/docs/ja/intlayer_with_vite+vue.md +1 -0
- package/docs/ko/intlayer_with_nuxt.md +307 -406
- package/docs/ko/intlayer_with_react_router_v7.md +33 -4
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +515 -0
- package/docs/ko/intlayer_with_tanstack.md +2 -12
- package/docs/ko/intlayer_with_vite+vue.md +1 -0
- package/docs/pl/intlayer_with_nuxt.md +282 -457
- package/docs/pl/intlayer_with_react_router_v7.md +32 -5
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +615 -0
- package/docs/pl/intlayer_with_tanstack.md +2 -12
- package/docs/pl/intlayer_with_vite+vue.md +1 -0
- package/docs/pt/intlayer_with_nuxt.md +288 -403
- package/docs/pt/intlayer_with_react_router_v7.md +28 -0
- package/docs/pt/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_nuxt.md +300 -410
- package/docs/ru/intlayer_with_react_router_v7.md +33 -4
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ru/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_vite+vue.md +1 -0
- package/docs/tr/intlayer_with_nuxt.md +327 -392
- package/docs/tr/intlayer_with_react_router_v7.md +33 -4
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +572 -0
- package/docs/tr/intlayer_with_tanstack.md +2 -12
- package/docs/tr/intlayer_with_vite+vue.md +1 -0
- package/docs/vi/intlayer_with_nuxt.md +282 -399
- package/docs/vi/intlayer_with_react_router_v7.md +29 -4
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +523 -0
- package/docs/vi/intlayer_with_tanstack.md +2 -12
- package/docs/vi/intlayer_with_vite+vue.md +1 -0
- package/docs/zh/intlayer_with_nuxt.md +311 -444
- package/docs/zh/intlayer_with_react_router_v7.md +33 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/zh/intlayer_with_tanstack.md +2 -12
- package/docs/zh/intlayer_with_vite+vue.md +1 -0
- package/package.json +6 -6
- package/src/generated/docs.entry.ts +19 -0
|
@@ -15,6 +15,7 @@ slugs:
|
|
|
15
15
|
- environment
|
|
16
16
|
- vite-and-vue
|
|
17
17
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-vue-template
|
|
18
|
+
youtubeVideo: https://www.youtube.com/watch?v=IE3XWkZ6a5U
|
|
18
19
|
history:
|
|
19
20
|
- version: 5.5.10
|
|
20
21
|
date: 2025-06-29
|
|
@@ -482,19 +483,9 @@ To change the language of your content, you can use the `setLocale` function pro
|
|
|
482
483
|
Create a component to switch between languages:
|
|
483
484
|
|
|
484
485
|
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
485
|
-
<template>
|
|
486
|
-
<div class="locale-switcher">
|
|
487
|
-
<select v-model="selectedLocale" @change="changeLocale">
|
|
488
|
-
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
489
|
-
{{ getLocaleName(loc) }}
|
|
490
|
-
</option>
|
|
491
|
-
</select>
|
|
492
|
-
</div>
|
|
493
|
-
</template>
|
|
494
|
-
|
|
495
486
|
<script setup lang="ts">
|
|
496
|
-
import { ref, watch } from "vue";
|
|
497
487
|
import { getLocaleName } from "intlayer";
|
|
488
|
+
import { ref, watch } from "vue";
|
|
498
489
|
import { useLocale } from "vue-intlayer";
|
|
499
490
|
|
|
500
491
|
// Get locale information and setLocale function
|
|
@@ -514,6 +505,16 @@ watch(
|
|
|
514
505
|
}
|
|
515
506
|
);
|
|
516
507
|
</script>
|
|
508
|
+
|
|
509
|
+
<template>
|
|
510
|
+
<div class="locale-switcher">
|
|
511
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
512
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
513
|
+
{{ getLocaleName(loc) }}
|
|
514
|
+
</option>
|
|
515
|
+
</select>
|
|
516
|
+
</div>
|
|
517
|
+
</template>
|
|
517
518
|
```
|
|
518
519
|
|
|
519
520
|
Then, use this component in your App.vue:
|
|
@@ -696,21 +697,11 @@ module.exports = defineConfig({
|
|
|
696
697
|
To automatically update the URL when the user changes the language, you can modify the `LocaleSwitcher` component to use Vue Router:
|
|
697
698
|
|
|
698
699
|
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
699
|
-
<template>
|
|
700
|
-
<div class="locale-switcher">
|
|
701
|
-
<select v-model="selectedLocale" @change="changeLocale">
|
|
702
|
-
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
703
|
-
{{ getLocaleName(loc) }}
|
|
704
|
-
</option>
|
|
705
|
-
</select>
|
|
706
|
-
</div>
|
|
707
|
-
</template>
|
|
708
|
-
|
|
709
700
|
<script setup lang="ts">
|
|
710
|
-
import { ref, watch } from "vue";
|
|
711
|
-
import { useRouter } from "vue-router";
|
|
712
701
|
import { Locales, getLocaleName, getLocalizedUrl } from "intlayer";
|
|
702
|
+
import { ref, watch } from "vue";
|
|
713
703
|
import { useLocale } from "vue-intlayer";
|
|
704
|
+
import { useRouter } from "vue-router";
|
|
714
705
|
|
|
715
706
|
// Get Vue Router
|
|
716
707
|
const router = useRouter();
|
|
@@ -743,6 +734,16 @@ watch(
|
|
|
743
734
|
}
|
|
744
735
|
);
|
|
745
736
|
</script>
|
|
737
|
+
|
|
738
|
+
<template>
|
|
739
|
+
<div class="locale-switcher">
|
|
740
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
741
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
742
|
+
{{ getLocaleName(loc) }}
|
|
743
|
+
</option>
|
|
744
|
+
</select>
|
|
745
|
+
</div>
|
|
746
|
+
</template>
|
|
746
747
|
```
|
|
747
748
|
|
|
748
749
|
Tip: For better SEO and accessibility, use tags as `<a href="/fr/home" hreflang="fr">` to link to localized pages, as shown in Step 10. This allows search engines to discover and index language-specific URLs properly. To preserve SPA behavior, you can prevent the default navigation with @click.prevent, change the locale using useLocale, and programmatically navigate using Vue Router.
|
|
@@ -852,15 +853,9 @@ This behavior is useful for several reasons:
|
|
|
852
853
|
- **Maintainability**: Centralizing the localization logic in a single component simplifies the management of URLs, making your codebase easier to maintain and extend as your application grows.
|
|
853
854
|
|
|
854
855
|
```vue fileName="src/components/Link.vue"
|
|
855
|
-
<template>
|
|
856
|
-
<a :href="localizedHref" v-bind="$attrs">
|
|
857
|
-
<slot />
|
|
858
|
-
</a>
|
|
859
|
-
</template>
|
|
860
|
-
|
|
861
856
|
<script setup lang="ts">
|
|
862
|
-
import { computed } from "vue";
|
|
863
857
|
import { getLocalizedUrl } from "intlayer";
|
|
858
|
+
import { computed } from "vue";
|
|
864
859
|
import { useLocale } from "vue-intlayer";
|
|
865
860
|
|
|
866
861
|
const props = defineProps({
|
|
@@ -880,20 +875,20 @@ const localizedHref = computed(() =>
|
|
|
880
875
|
isExternalLink.value ? props.href : getLocalizedUrl(props.href, locale.value)
|
|
881
876
|
);
|
|
882
877
|
</script>
|
|
883
|
-
```
|
|
884
|
-
|
|
885
|
-
For use with Vue Router, create a router-specific version:
|
|
886
878
|
|
|
887
|
-
```vue fileName="src/components/RouterLink.vue"
|
|
888
879
|
<template>
|
|
889
|
-
<
|
|
880
|
+
<a :href="localizedHref" v-bind="$attrs">
|
|
890
881
|
<slot />
|
|
891
|
-
</
|
|
882
|
+
</a>
|
|
892
883
|
</template>
|
|
884
|
+
```
|
|
893
885
|
|
|
886
|
+
For use with Vue Router, create a router-specific version:
|
|
887
|
+
|
|
888
|
+
```vue fileName="src/components/RouterLink.vue"
|
|
894
889
|
<script setup lang="ts">
|
|
895
|
-
import { computed } from "vue";
|
|
896
890
|
import { getLocalizedUrl } from "intlayer";
|
|
891
|
+
import { computed } from "vue";
|
|
897
892
|
import { useLocale } from "vue-intlayer";
|
|
898
893
|
|
|
899
894
|
const props = defineProps({
|
|
@@ -918,11 +913,22 @@ const localizedTo = computed(() => {
|
|
|
918
913
|
}
|
|
919
914
|
});
|
|
920
915
|
</script>
|
|
916
|
+
|
|
917
|
+
<template>
|
|
918
|
+
<router-link :to="localizedTo" v-bind="$attrs">
|
|
919
|
+
<slot />
|
|
920
|
+
</router-link>
|
|
921
|
+
</template>
|
|
921
922
|
```
|
|
922
923
|
|
|
923
924
|
Use these components in your application:
|
|
924
925
|
|
|
925
926
|
```vue fileName="src/App.vue"
|
|
927
|
+
<script setup lang="ts">
|
|
928
|
+
import Link from "@components/Link.vue";
|
|
929
|
+
import RouterLink from "@components/RouterLink.vue";
|
|
930
|
+
</script>
|
|
931
|
+
|
|
926
932
|
<template>
|
|
927
933
|
<div>
|
|
928
934
|
<!-- Vue router -->
|
|
@@ -933,11 +939,6 @@ Use these components in your application:
|
|
|
933
939
|
<Link href="/home">Home</Link>
|
|
934
940
|
</div>
|
|
935
941
|
</template>
|
|
936
|
-
|
|
937
|
-
<script setup lang="ts">
|
|
938
|
-
import Link from "@components/Link.vue";
|
|
939
|
-
import RouterLink from "@components/RouterLink.vue";
|
|
940
|
-
</script>
|
|
941
942
|
```
|
|
942
943
|
|
|
943
944
|
### (Optional) Step 11: Render Markdown
|
|
@@ -975,17 +976,17 @@ installIntlayerMarkdown(app, (markdown) => {
|
|
|
975
976
|
Once registered, you can use the component-based syntax to display the Markdown content directly:
|
|
976
977
|
|
|
977
978
|
```vue
|
|
978
|
-
<template>
|
|
979
|
-
<div>
|
|
980
|
-
<myMarkdownContent />
|
|
981
|
-
</div>
|
|
982
|
-
</template>
|
|
983
|
-
|
|
984
979
|
<script setup lang="ts">
|
|
985
980
|
import { useIntlayer } from "vue-intlayer";
|
|
986
981
|
|
|
987
982
|
const { myMarkdownContent } = useIntlayer("my-component");
|
|
988
983
|
</script>
|
|
984
|
+
|
|
985
|
+
<template>
|
|
986
|
+
<div>
|
|
987
|
+
<myMarkdownContent />
|
|
988
|
+
</div>
|
|
989
|
+
</template>
|
|
989
990
|
```
|
|
990
991
|
|
|
991
992
|
### Configure TypeScript
|