Some Chinese text fixes

This commit is contained in:
DrMint 2023-06-03 21:23:03 +02:00
parent 7bde24adaa
commit c3796b4fe8
5 changed files with 45 additions and 22 deletions

View File

@ -109,11 +109,11 @@
"previous_content": "{ count, plural, =0 {No previous content} one {Previous content} other {Previous contents} }", "previous_content": "{ count, plural, =0 {No previous content} one {Previous content} other {Previous contents} }",
"followup_content": "{ count, plural, =0 {No follow-up content} one {Follow-up content} other {Follow-up contents} }", "followup_content": "{ count, plural, =0 {No follow-up content} one {Follow-up content} other {Follow-up contents} }",
"videos": "Videos", "videos": "Videos",
"view_on": "View on", "view_on_x": "View on {x}",
"channel": "Channel", "channel": "Channel",
"subscribers": "Subscribers", "subscribers": "Subscribers",
"description": "Description", "description": "Description",
"available_at": "Available at", "available_at_x": "Available at {x}",
"want_it": "I want it!", "want_it": "I want it!",
"have_it": "I have it!", "have_it": "I have it!",
"source": "Source", "source": "Source",
@ -289,11 +289,11 @@
"previous_content": "Contenu précédent", "previous_content": "Contenu précédent",
"followup_content": "Contenu suivant", "followup_content": "Contenu suivant",
"videos": "Videos", "videos": "Videos",
"view_on": "Voir sur", "view_on_x": "Voir sur {x}",
"channel": "Chaîne", "channel": "Chaîne",
"subscribers": "Abonnés", "subscribers": "Abonnés",
"description": "Description", "description": "Description",
"available_at": "Disponible sur", "available_at_x": "Disponible sur {x}",
"want_it": "Je le veux !", "want_it": "Je le veux !",
"have_it": "Je l'ai !", "have_it": "Je l'ai !",
"source": "Source", "source": "Source",
@ -469,11 +469,11 @@
"previous_content": "前のコンテンツ", "previous_content": "前のコンテンツ",
"followup_content": "フォローアップコンテンツ", "followup_content": "フォローアップコンテンツ",
"videos": "動画", "videos": "動画",
"view_on": "見る", "view_on_x": null,
"channel": "チャンネル", "channel": "チャンネル",
"subscribers": "サブスクライバー", "subscribers": "サブスクライバー",
"description": "説明", "description": "説明",
"available_at": "でご覧いただけます。", "available_at_x": null,
"want_it": "欲しいです!", "want_it": "欲しいです!",
"have_it": "持ってます!", "have_it": "持ってます!",
"source": "出典", "source": "出典",
@ -649,11 +649,11 @@
"previous_content": "Contenido anterior", "previous_content": "Contenido anterior",
"followup_content": "Contenido siguiente", "followup_content": "Contenido siguiente",
"videos": "Vídeos", "videos": "Vídeos",
"view_on": null, "view_on_x": null,
"channel": "Canal", "channel": "Canal",
"subscribers": "Suscriptores", "subscribers": "Suscriptores",
"description": "Descripción", "description": "Descripción",
"available_at": "Disponible en", "available_at_x": "Disponible en {x}",
"want_it": "Lo quiero!", "want_it": "Lo quiero!",
"have_it": "Lo tengo!", "have_it": "Lo tengo!",
"source": "Fuente", "source": "Fuente",
@ -829,11 +829,11 @@
"previous_content": "Conteúdo anterior:", "previous_content": "Conteúdo anterior:",
"followup_content": "Próximo conteúdo:", "followup_content": "Próximo conteúdo:",
"videos": "Videos:", "videos": "Videos:",
"view_on": "Ver no:", "view_on_x": "Ver no {x}",
"channel": "Canal", "channel": "Canal",
"subscribers": "Inscritos", "subscribers": "Inscritos",
"description": "Descrição", "description": "Descrição",
"available_at": "Disponível no:", "available_at_x": "Disponível no {x}",
"want_it": null, "want_it": null,
"have_it": null, "have_it": null,
"source": null, "source": null,
@ -1009,11 +1009,11 @@
"previous_content": "{ count, plural, =0 {本文为第一部分} one {上一章节} other {相关章节} }", "previous_content": "{ count, plural, =0 {本文为第一部分} one {上一章节} other {相关章节} }",
"followup_content": "{ count, plural, =0 {本文为最后一部分} one {下一章节} other {后续章节} }", "followup_content": "{ count, plural, =0 {本文为最后一部分} one {下一章节} other {后续章节} }",
"videos": "影像", "videos": "影像",
"view_on": null, "view_on_x": "前往 {x} 观看",
"channel": "频道", "channel": "频道",
"subscribers": "订阅数", "subscribers": "订阅数",
"description": "简介", "description": "简介",
"available_at": "可在", "available_at_x": "可在 {x} 查看或购买",
"want_it": "想要!", "want_it": "想要!",
"have_it": "已入手!", "have_it": "已入手!",
"source": "来源", "source": "来源",

View File

@ -104,11 +104,11 @@ export interface ICUParams {
previous_content: { count: number }; previous_content: { count: number };
followup_content: { count: number }; followup_content: { count: number };
videos: never; videos: never;
view_on: never; view_on_x: { x: Date | boolean | number | string };
channel: never; channel: never;
subscribers: never; subscribers: never;
description: never; description: never;
available_at: never; available_at_x: { x: Date | boolean | number | string };
want_it: never; want_it: never;
have_it: never; have_it: never;
source: never; source: never;

View File

@ -1,3 +1,4 @@
import { ReactNode, useMemo } from "react";
import { HorizontalLine } from "components/HorizontalLine"; import { HorizontalLine } from "components/HorizontalLine";
import { insertInBetweenArray } from "helpers/others"; import { insertInBetweenArray } from "helpers/others";
import { isDefined } from "helpers/asserts"; import { isDefined } from "helpers/asserts";
@ -44,3 +45,19 @@ export const ElementsSeparator = ({
}: ElementsSeparatorProps): JSX.Element => ( }: ElementsSeparatorProps): JSX.Element => (
<>{insertInBetweenArray(children.filter(Boolean), separator)}</> <>{insertInBetweenArray(children.filter(Boolean), separator)}</>
); );
interface FormatWithComponentProps {
text: string;
component: React.ReactNode;
}
export const formatWithComponentSplitter = " [SPLITTER] ";
export const FormatWithComponent = ({ text, component }: FormatWithComponentProps): JSX.Element => {
const splittedText = useMemo<ReactNode[]>(() => {
const result = text.split("[SPLITTER]");
return result;
}, [text]);
console.log(splittedText);
return <ElementsSeparator separator={component}>{splittedText}</ElementsSeparator>;
};

View File

@ -104,7 +104,7 @@ const Video = ({ video, ...otherProps }: Props): JSX.Element => {
{video.source === "YouTube" && ( {video.source === "YouTube" && (
<Button <Button
size="small" size="small"
text={`${format("view_on")} ${video.source}`} text={format("view_on_x", { x: video.source })}
href={`https://youtu.be/${video.uid}`} href={`https://youtu.be/${video.uid}`}
alwaysNewTab alwaysNewTab
/> />

View File

@ -51,7 +51,11 @@ import { atoms } from "contexts/atoms";
import { useAtomGetter, useAtomSetter } from "helpers/atoms"; import { useAtomGetter, useAtomSetter } from "helpers/atoms";
import { useFormat } from "hooks/useFormat"; import { useFormat } from "hooks/useFormat";
import { getFormat } from "helpers/i18n"; import { getFormat } from "helpers/i18n";
import { ElementsSeparator } from "helpers/component"; import {
ElementsSeparator,
FormatWithComponent,
formatWithComponentSplitter,
} from "helpers/component";
import { ToolTip } from "components/ToolTip"; import { ToolTip } from "components/ToolTip";
import { AudioPlayer } from "components/Player"; import { AudioPlayer } from "components/Player";
@ -239,12 +243,14 @@ const LibrarySlug = ({
<> <>
{item.urls?.length ? ( {item.urls?.length ? (
<div className="flex flex-row place-items-center gap-3"> <div className="flex flex-row place-items-center gap-3">
<p>{format("available_at")}</p> <FormatWithComponent
{filterHasAttributes(item.urls, ["url"]).map((url, index) => ( text={format("available_at_x", { x: formatWithComponentSplitter })}
<Fragment key={index}> component={filterHasAttributes(item.urls, ["url"]).map((url, index) => (
<Button href={url.url} text={prettyURL(url.url)} alwaysNewTab /> <Fragment key={index}>
</Fragment> <Button href={url.url} text={prettyURL(url.url)} alwaysNewTab />
))} </Fragment>
))}
/>
</div> </div>
) : ( ) : (
<p>{format("item_not_available")}</p> <p>{format("item_not_available")}</p>