feat(ui): add framework-neutral localization support
- add a lightweight UI i18n provider with translation and locale contexts\n- localize accessibility labels across breadcrumb, carousel, dialog, pagination, sheet, sidebar, spinner, and toast components\n- integrate calendar locale data without coupling UI components to Lingui\n- publish tree-shakeable catalogs for eight common locales
This commit is contained in:
@@ -6,6 +6,7 @@ import useEmblaCarousel, {
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
import { Button } from "@workspace/ui/components/button"
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
|
||||
import { LocalizedText, uiMessages } from "./i18n"
|
||||
|
||||
type CarouselApi = UseEmblaCarouselType[1]
|
||||
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
||||
@@ -186,7 +187,7 @@ function CarouselPrevious({
|
||||
"absolute touch-manipulation rounded-full",
|
||||
orientation === "horizontal"
|
||||
? "inset-y-0 -start-12 my-auto"
|
||||
: "-top-12 start-1/2 -translate-x-1/2 rtl:translate-x-1/2 rotate-90",
|
||||
: "start-1/2 -top-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2",
|
||||
className
|
||||
)}
|
||||
disabled={!canScrollPrev}
|
||||
@@ -194,7 +195,9 @@ function CarouselPrevious({
|
||||
{...props}
|
||||
>
|
||||
<ChevronLeftIcon className="rtl:rotate-180" />
|
||||
<span className="sr-only">Previous slide</span>
|
||||
<span className="sr-only">
|
||||
<LocalizedText message={uiMessages.previousSlide} />
|
||||
</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -216,7 +219,7 @@ function CarouselNext({
|
||||
"absolute touch-manipulation rounded-full",
|
||||
orientation === "horizontal"
|
||||
? "inset-y-0 -end-12 my-auto"
|
||||
: "-bottom-12 start-1/2 -translate-x-1/2 rtl:translate-x-1/2 rotate-90",
|
||||
: "start-1/2 -bottom-12 -translate-x-1/2 rotate-90 rtl:translate-x-1/2",
|
||||
className
|
||||
)}
|
||||
disabled={!canScrollNext}
|
||||
@@ -224,7 +227,9 @@ function CarouselNext({
|
||||
{...props}
|
||||
>
|
||||
<ChevronRightIcon className="rtl:rotate-180" />
|
||||
<span className="sr-only">Next slide</span>
|
||||
<span className="sr-only">
|
||||
<LocalizedText message={uiMessages.nextSlide} />
|
||||
</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user