feat: add Russian localization and independent STT languages
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
"use client";
|
||||
import { useI18n } from "@/components/i18n";
|
||||
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -31,6 +33,8 @@ import {
|
||||
import remarkBreaks from "remark-breaks";
|
||||
import {
|
||||
Streamdown,
|
||||
defaultTranslations,
|
||||
type StreamdownTranslations,
|
||||
type PluginConfig,
|
||||
} from "streamdown";
|
||||
import { mdComponents } from "@/components/md-blocks";
|
||||
@@ -264,11 +268,12 @@ export const MessageBranchPrevious = ({
|
||||
children,
|
||||
...props
|
||||
}: MessageBranchPreviousProps) => {
|
||||
const { t } = useI18n();
|
||||
const { goToPrevious, totalBranches } = useMessageBranch();
|
||||
|
||||
return (
|
||||
<Button
|
||||
aria-label="Previous branch"
|
||||
aria-label={t("Previous branch")}
|
||||
disabled={totalBranches <= 1}
|
||||
onClick={goToPrevious}
|
||||
size="icon-sm"
|
||||
@@ -287,11 +292,12 @@ export const MessageBranchNext = ({
|
||||
children,
|
||||
...props
|
||||
}: MessageBranchNextProps) => {
|
||||
const { t } = useI18n();
|
||||
const { goToNext, totalBranches } = useMessageBranch();
|
||||
|
||||
return (
|
||||
<Button
|
||||
aria-label="Next branch"
|
||||
aria-label={t("Next branch")}
|
||||
disabled={totalBranches <= 1}
|
||||
onClick={goToNext}
|
||||
size="icon-sm"
|
||||
@@ -310,6 +316,7 @@ export const MessageBranchPage = ({
|
||||
className,
|
||||
...props
|
||||
}: MessageBranchPageProps) => {
|
||||
const { t } = useI18n();
|
||||
const { currentBranch, totalBranches } = useMessageBranch();
|
||||
|
||||
return (
|
||||
@@ -320,7 +327,7 @@ export const MessageBranchPage = ({
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{currentBranch + 1} of {totalBranches}
|
||||
{currentBranch + 1}{" "}{t("of")}{" "}{totalBranches}
|
||||
</ButtonGroupText>
|
||||
);
|
||||
};
|
||||
@@ -357,6 +364,8 @@ export const streamdownPlugins = {
|
||||
|
||||
export const MessageResponse = memo(
|
||||
({ className, children, ...props }: MessageResponseProps) => {
|
||||
const { t } = useI18n();
|
||||
const translations = Object.fromEntries(Object.entries(defaultTranslations).map(([key, text]) => [key, t(text)])) as Partial<StreamdownTranslations>;
|
||||
// Legacy backslash delimiters are converted in a single linear scan;
|
||||
// native dollar math passes through to Streamdown unchanged. Incomplete
|
||||
// legacy spans are left for a later render when their closer arrives.
|
||||
@@ -373,6 +382,7 @@ export const MessageResponse = memo(
|
||||
"lh-prose size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
||||
className
|
||||
)}
|
||||
translations={translations}
|
||||
components={mdComponents}
|
||||
plugins={streamdownPlugins}
|
||||
{...props}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"use client";
|
||||
import { useI18n } from "@/components/i18n";
|
||||
|
||||
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
||||
import { blurAfterPointerClick } from "@/components/focus-hygiene";
|
||||
@@ -134,20 +135,22 @@ export type ReasoningTriggerProps = ComponentProps<
|
||||
for a few seconds"), bookkeeping for information we knowingly lose. The
|
||||
label pairs with the user's collapsed "Your thinking" rows — one
|
||||
language; motion (spinner + shimmer) stays the working signal. */
|
||||
const defaultGetThinkingMessage = (isStreaming: boolean) => {
|
||||
const DefaultThinkingMessage = ({ isStreaming }: { isStreaming: boolean }) => {
|
||||
const { t } = useI18n();
|
||||
if (isStreaming) {
|
||||
return <Shimmer duration={1}>Thinking...</Shimmer>;
|
||||
return <Shimmer duration={1}>{t("Thinking...")}</Shimmer>;
|
||||
}
|
||||
return <p>AGENT’S THINKING</p>;
|
||||
return <p>{t("AGENT’S THINKING")}</p>;
|
||||
};
|
||||
|
||||
export const ReasoningTrigger = memo(
|
||||
({
|
||||
className,
|
||||
children,
|
||||
getThinkingMessage = defaultGetThinkingMessage,
|
||||
getThinkingMessage = (isStreaming) => <DefaultThinkingMessage isStreaming={isStreaming} />,
|
||||
...props
|
||||
}: ReasoningTriggerProps) => {
|
||||
const { t } = useI18n();
|
||||
const { isStreaming, isOpen } = useReasoning();
|
||||
|
||||
return (
|
||||
@@ -175,7 +178,7 @@ export const ReasoningTrigger = memo(
|
||||
the component default (h-3) — IDENTICAL to the placeholder
|
||||
spinner (owner, 2026-10-02): the handoff between the two
|
||||
states must be visually seamless, one size everywhere. */}
|
||||
{isStreaming && <BrailleSpinner label="Thinking" />}
|
||||
{isStreaming && <BrailleSpinner label={t("Thinking")} />}
|
||||
{getThinkingMessage(isStreaming)}
|
||||
<ChevronDownIcon
|
||||
className={cn(
|
||||
|
||||
Reference in New Issue
Block a user