cart.tsCart.tsxCart.vueCart.svelteCart.tsxapp/[locale]/Cart.tsxcomponents/Cart.vue
1// cart: <a>{n, plural, one {# item} other {# items}}</a>
2import { createI18n } from "@comvi/core";
3import { icuCompiler } from "@comvi/core/icu";
4import { prepareTranslation } from "@comvi/core/rich-text";
5import en from "./locales/en.json";
6const i18n = createI18n({ locale: "en", messages: { en },
7 compiler: icuCompiler });
8await i18n.init();
9const { content } = prepareTranslation(i18n, {
10 i18nKey: "cart", params: { n: 3 },
11 components: { a: { tag: "a", props: { href: "/cart" } } },
12});
13// i18n.t("greeting.helo") → error TS2345:
14// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
1// cart: <a>{n, plural, one {# item} other {# items}}</a>
2import { useI18n, T } from "@comvi/react";
3
4export function Cart({ count }: { count: number }) {
5 const { t } = useI18n();
6 return (
7 <T i18nKey="cart" params={{ n: count }}
8 components={{ a: <a href="/cart" /> }} />
9 );
10}
11// t("greeting.helo") → error TS2345:
12// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
1<script setup lang="ts">
2// cart: <a>{n, plural, one {# item} other {# items}}</a>
3import { useI18n, T } from "@comvi/vue";
4defineProps<{ count: number }>();
5const { t } = useI18n();
6// t("greeting.helo") → error TS2345:
7// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
8</script>
9
10<template>
11 <T i18nKey="cart" :params="{ n: count }">
12 <template #a="{ children }"><a href="/cart">{{ children }}</a></template>
13 </T>
14</template>
1<script lang="ts">
2 // cart: <a>{n, plural, one {# item} other {# items}}</a>
3 import { useI18n, T } from "@comvi/svelte";
4
5 const { count }: { count: number } = $props();
6 const { t } = useI18n();
7 // $t("greeting.helo") → error TS2345:
8 // Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
9</script>
10
11<T i18nKey="cart" params={{ n: count }}
12 components={{ a: { tag: "a", props: { href: "/cart" } } }} />
1// cart: <a>{n, plural, one {# item} other {# items}}</a>
2import { useI18n, T } from "@comvi/solid";
3
4export function Cart(props: { count: number }) {
5 const { t } = useI18n();
6 return (
7 <T i18nKey="cart" params={{ n: props.count }}
8 components={{ a: (p) => <a href="/cart">{p.children}</a> }} />
9 );
10}
11// t("greeting.helo") → error TS2345:
12// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
1"use client";
2// cart: <a>{n, plural, one {# item} other {# items}}</a>
3import { useI18n, T } from "@comvi/next/client";
4
5export function Cart({ count }: { count: number }) {
6 const { t } = useI18n();
7 return (
8 <T i18nKey="cart" params={{ n: count }}
9 components={{ a: <a href="/cart" /> }} />
10 );
11}
12// t("greeting.helo") → error TS2345:
13// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
1<script setup lang="ts">
2// cart: <a>{n, plural, one {# item} other {# items}}</a>
3defineProps<{ count: number }>();
4const { t } = useI18n();
5// t("greeting.helo") → error TS2345:
6// Argument of type '"greeting.helo"' is not assignable to parameter of type '…'.
7</script>
8<template>
9 <T i18nKey="cart" :params="{ n: count }">
10 <template #a="{ children }">
11 <NuxtLinkLocale to="/cart">{{ children }}</NuxtLinkLocale>
12 </template>
13 </T>
14</template>