Skip to content

Commit

Permalink
fix language detection in TrackedTextarea (#1796)
Browse files Browse the repository at this point in the history
  • Loading branch information
notmd committed Feb 22, 2023
1 parent c8a0feb commit e38d639
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions website/src/components/Survey/TrackedTextarea.tsx
Expand Up @@ -3,8 +3,8 @@ import { Progress, Stack, Textarea, TextareaProps, useColorModeValue } from "@ch
import lande from "lande";
import { useTranslation } from "next-i18next";
import React from "react";
import { useCookies } from "react-cookie";
import TextareaAutosize, { TextareaAutosizeProps } from "react-textarea-autosize";
import { useCurrentLocale } from "src/hooks/locale/useCurrentLocale";
import { LanguageAbbreviations } from "src/lib/iso6393";
import { getLocaleDisplayName } from "src/lib/languages";
import { colors } from "src/styles/Theme/colors";
Expand All @@ -24,8 +24,7 @@ export const TrackedTextarea = (props: TrackedTextboxProps) => {
const { t } = useTranslation("tasks");
const wordLimitForLangDetection = 4;
const backgroundColor = useColorModeValue("gray.100", "gray.900");
const [cookies] = useCookies(["NEXT_LOCALE"]);
const currentLanguage = cookies["NEXT_LOCALE"];
const currentLanguage = useCurrentLocale();
const wordCount = (props.text.match(/\w+/g) || []).length;

const detectLang = (text: string) => {
Expand Down

0 comments on commit e38d639

Please sign in to comment.