diff --git a/web/components/profile-about.tsx b/web/components/profile-about.tsx index 15eb00f..4dd8321 100644 --- a/web/components/profile-about.tsx +++ b/web/components/profile-about.tsx @@ -183,7 +183,7 @@ function RelationshipType(props: { profile: Profile }) { const relationshipTypes = profile.pref_relation_styles let seekingGenderText = stringOrStringArrayToText({ text: relationshipTypes?.map((rel) => - t(`profile.relationship.${rel}`, convertRelationshipType(rel as RelationshipType)) + t(`profile.relationship.${rel}`, convertRelationshipType(rel as RelationshipType)).toLowerCase() ).sort(), preText: t('profile.seeking', 'Seeking'), asSentence: true, diff --git a/web/components/profile-comments.tsx b/web/components/profile-comments.tsx index 1286010..fceb1b3 100644 --- a/web/components/profile-comments.tsx +++ b/web/components/profile-comments.tsx @@ -1,37 +1,36 @@ import clsx from 'clsx' -import { memo, ReactNode, useEffect, useRef, useState } from 'react' +import {memo, ReactNode, useEffect, useRef, useState} from 'react' -import { FlagIcon } from '@heroicons/react/outline' -import { DotsHorizontalIcon, ReplyIcon } from '@heroicons/react/solid' -import { buildArray } from 'common/util/array' -import { toast } from 'react-hot-toast' -import { ReportModal } from 'web/components/buttons/report-button' +import {EyeOffIcon, FlagIcon} from '@heroicons/react/outline' +import {DotsHorizontalIcon, ReplyIcon} from '@heroicons/react/solid' +import {buildArray} from 'common/util/array' +import {toast} from 'react-hot-toast' +import {ReportModal} from 'web/components/buttons/report-button' import DropdownMenu from 'web/components/comments/dropdown-menu' -import { Col } from 'web/components/layout/col' -import { Row } from 'web/components/layout/row' -import { Avatar } from 'web/components/widgets/avatar' -import { UserLink } from 'web/components/widgets/user-link' -import { useEvent } from 'web/hooks/use-event' -import { useUser } from 'web/hooks/use-user' -import { firebaseLogin, User } from 'web/lib/firebase/users' +import {Col} from 'web/components/layout/col' +import {Row} from 'web/components/layout/row' +import {Avatar} from 'web/components/widgets/avatar' +import {UserLink} from 'web/components/widgets/user-link' +import {useEvent} from 'web/hooks/use-event' +import {useUser} from 'web/hooks/use-user' +import {firebaseLogin, User} from 'web/lib/firebase/users' import TriangleDownFillIcon from 'web/lib/icons/triangle-down-fill-icon.svg' import TriangleFillIcon from 'web/lib/icons/triangle-fill-icon.svg' -import { scrollIntoViewCentered } from 'web/lib/util/scroll' -import { Button, IconButton } from 'web/components/buttons/button' -import { ReplyToggle } from 'web/components/comments/reply-toggle' -import { Content, useTextEditor } from 'web/components/widgets/editor' -import { Tooltip } from 'web/components/widgets/tooltip' -import { type Comment } from 'common/comment' -import { CommentInputTextArea } from 'web/components/comments/comment-input' -import { Editor } from '@tiptap/react' -import { track } from 'web/lib/service/analytics' -import { api } from 'web/lib/api' -import { RelativeTimestamp } from 'web/components/relative-timestamp' -import { useAdmin } from 'web/hooks/use-admin' -import { EyeOffIcon } from '@heroicons/react/outline' -import { useProfileByUserId } from 'web/hooks/use-profile' -import { MAX_COMMENT_LENGTH, ReplyToUserInfo } from 'common/comment' -import { safeLocalStorage } from 'web/lib/util/local' +import {scrollIntoViewCentered} from 'web/lib/util/scroll' +import {Button, IconButton} from 'web/components/buttons/button' +import {ReplyToggle} from 'web/components/comments/reply-toggle' +import {Content, useTextEditor} from 'web/components/widgets/editor' +import {Tooltip} from 'web/components/widgets/tooltip' +import {type Comment, MAX_COMMENT_LENGTH, ReplyToUserInfo} from 'common/comment' +import {CommentInputTextArea} from 'web/components/comments/comment-input' +import {Editor} from '@tiptap/react' +import {track} from 'web/lib/service/analytics' +import {api} from 'web/lib/api' +import {RelativeTimestamp} from 'web/components/relative-timestamp' +import {useAdmin} from 'web/hooks/use-admin' +import {useProfileByUserId} from 'web/hooks/use-profile' +import {safeLocalStorage} from 'web/lib/util/local' +import {useT} from "web/lib/locale"; export function ProfileProfileCommentThread(props: { onUser: User @@ -391,6 +390,7 @@ export function ProfileCommentInput(props: { clearReply, trackingLocation, } = props + const t = useT() const user = useUser() const onSubmitComment = useEvent(async (editor: Editor) => { if (!user) { @@ -414,7 +414,7 @@ export function ProfileCommentInput(props: { onSubmitComment={onSubmitComment} replyToUserInfo={replyToUserInfo} parentCommentId={parentCommentId} - placeholder="Write your endorsement..." + placeholder={t('profile.comments.placeholder', 'Write your endorsement...')} className={className} /> ) diff --git a/web/lib/util/string-or-string-array-to-text.ts b/web/lib/util/string-or-string-array-to-text.ts index 28cc80d..e6c90cb 100644 --- a/web/lib/util/string-or-string-array-to-text.ts +++ b/web/lib/util/string-or-string-array-to-text.ts @@ -1,4 +1,5 @@ -import { filterDefined } from 'common/util/array' +import {filterDefined} from 'common/util/array' +import {useT} from "web/lib/locale"; export default function stringOrStringArrayToText(fields: { text: string[] | string | null | undefined @@ -14,6 +15,7 @@ export default function stringOrStringArrayToText(fields: { asSentence, capitalizeFirstLetterOption, } = fields + const t = useT() if (!text || text.length < 1) { return null @@ -29,7 +31,7 @@ export default function stringOrStringArrayToText(fields: { if (asSentence) { formattedText = text.slice(0, -1).map(formatText).join(', ') + - (text.length > 1 ? ' and ' : '') + + (text.length > 1 ? ` ${t("common.and", "and")} ` : '') + formatText(text[text.length - 1]) } else { formattedText = filterDefined(text).map(formatText).join(' • ') diff --git a/web/messages/de.json b/web/messages/de.json index 98a57a7..6d962a8 100644 --- a/web/messages/de.json +++ b/web/messages/de.json @@ -117,6 +117,7 @@ "charts.date": "Datum", "common.active": "Aktiv", "common.add": "Hinzufügen", + "common.and": "und", "common.close": "Schließen", "common.compatible": "Kompatibel", "common.either": "Egal", @@ -391,6 +392,8 @@ "profile.causes.mental_health": "Psychische Gesundheit", "profile.causes.sustainability": "Nachhaltigkeit", "profile.comments.current_user_hint": "Andere Benutzer können Ihnen hier Empfehlungen hinterlassen.", + "profile.comments.add_comment": "Kommentar hinzufügen", + "profile.comments.placeholder": "Schreiben Sie Ihre Empfehlung...", "profile.comments.disabled": "Empfehlungen deaktiviert", "profile.comments.disabling": "Empfehlungen anderer Benutzer werden deaktiviert", "profile.comments.enable_tooltip": "Empfehlungen anderer Benutzer aktivieren/deaktivieren", diff --git a/web/messages/fr.json b/web/messages/fr.json index f2ac1b8..5259ebf 100644 --- a/web/messages/fr.json +++ b/web/messages/fr.json @@ -117,6 +117,7 @@ "charts.date": "Date", "common.active": "Actif", "common.add": "Ajouter", + "common.and": "et", "common.close": "Fermer", "common.compatible": "Compatible", "common.either": "N'importe", @@ -391,6 +392,8 @@ "profile.causes.mental_health": "Santé mentale", "profile.causes.sustainability": "Durabilité", "profile.comments.current_user_hint": "Les autres utilisateurs peuvent vous laisser des recommandations ici.", + "profile.comments.add_comment": "Ajouter un commentaire", + "profile.comments.placeholder": "Écrivez votre recommandation...", "profile.comments.disabled": "Recommandations désactivées", "profile.comments.disabling": "Désactivation des recommandations des autres utilisateurs", "profile.comments.enable_tooltip": "Activer/Désactiver les recommandations des autres utilisateurs",