add multi language support

This commit is contained in:
2022-07-22 11:52:06 +08:00
parent ff85724982
commit ba1e96db26
25 changed files with 494 additions and 252 deletions

View File

@@ -1,25 +1,28 @@
import { Link } from "react-router-dom";
import { convertIntToDateTime } from "./Common";
import { Tr, tr, langCodeContext } from "../translate";
import { useContext } from "react";
function ReviewEntry(props) {
const { langCode } = useContext(langCodeContext);
return (
<div>
<h4>
<Link to={`/manage/users/${props.review.user.id}`}>
@{props.review.user.username}
</Link>{" "}
review{" "}
{Tr("review")}{" "}
<Link to={`/files/${props.review.file.id}`}>
{props.review.file.filename}
</Link>{" "}
on {convertIntToDateTime(props.review.created_at)}{" "}
{Tr("on")} {convertIntToDateTime(props.review.created_at)}{" "}
{props.review.updated_at !== 0 &&
"(modified on " +
convertIntToDateTime(props.review.updated_at) +
")"}{" "}
`(${tr("modified on", langCode)} ${convertIntToDateTime(
props.review.updated_at
)} ) `}
{(props.user.role === 1 || props.review.user.id === props.user.id) &&
props.user.role !== 0 && (
<Link to={`/manage/reviews/${props.review.id}`}>Edit</Link>
<Link to={`/manage/reviews/${props.review.id}`}>{Tr("Edit")}</Link>
)}
</h4>
<p>{props.review.content}</p>