Handle plurals and context with Variants
mainVariants allow you to handle plurals and context within a single translation key using a specific syntax: key{{ variable: value }}.
Plurals: Numbers will match the closest value. Context: Use non-numeric values to match specific contexts.
{
"car": "There is a car.",
"car{{ cars: 2 }}": "There are two cars.",
"context{{ weather: 'rain' }}": "It's rainy."
}import { t } from "astro-i18n"
t("car", { cars: 2 }) // "There are two cars."
t("context", { weather: "rain" }) // "It's rainy."t("car", { cars: 2 })
t("context", { weather: "rain" })