mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-09 11:15:08 +08:00
website: Use existing translations of language names (#1349)
Removed language.json translation file as we don't really need it anymore, just moved the couple of remaining items into tasks.json I also reverted the change where I created lang_mismatch_lang and lang_mismatch_lang.explanation because we don't actually need two different strings and it was causing an issue where it would show a mix of english and the users language rather than just show the existing "Wrong language" text that is probably a better intermediate until the translations are updated. Let me know if there is a better way to handle updating the source english text for translations.
This commit is contained in:
@@ -4,7 +4,6 @@ import lande from "lande";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import React from "react";
|
||||
import { useCookies } from "react-cookie";
|
||||
import { getTypeSafei18nKey } from "src/lib/i18n";
|
||||
import { LanguageAbbreviations } from "src/lib/iso6393";
|
||||
import { colors } from "src/styles/Theme/colors";
|
||||
|
||||
@@ -20,12 +19,12 @@ interface TrackedTextboxProps {
|
||||
}
|
||||
|
||||
export const TrackedTextarea = (props: TrackedTextboxProps) => {
|
||||
const { t } = useTranslation("language");
|
||||
const { t } = useTranslation("tasks");
|
||||
const wordLimitForLangDetection = 4;
|
||||
const backgroundColor = useColorModeValue("gray.100", "gray.900");
|
||||
const [cookies] = useCookies(["NEXT_LOCALE"]);
|
||||
const wordCount = (props.text.match(/\w+/g) || []).length;
|
||||
const currentLanguage = cookies["NEXT_LOCALE"];
|
||||
const wordCount = (props.text.match(/\w+/g) || []).length;
|
||||
|
||||
const detectLang = (text: string) => {
|
||||
try {
|
||||
@@ -81,8 +80,8 @@ export const TrackedTextarea = (props: TrackedTextboxProps) => {
|
||||
>
|
||||
<Tooltip
|
||||
label={t(wrongLanguage ? "writing_wrong_langauge_a_b" : "submitted_as", {
|
||||
submit_lang: t(getTypeSafei18nKey(`lang_${currentLanguage}`), currentLanguage),
|
||||
detected_lang: t(getTypeSafei18nKey(`lang_${detectedLang}`), detectedLang),
|
||||
submit_lang: new Intl.DisplayNames(currentLanguage, { type: "language" }).of(currentLanguage),
|
||||
detected_lang: new Intl.DisplayNames(currentLanguage, { type: "language" }).of(detectedLang),
|
||||
})}
|
||||
>
|
||||
{detectedLang}
|
||||
|
||||
Reference in New Issue
Block a user