From d120a9a933368e03a9c4cd501c8165c6112e396a Mon Sep 17 00:00:00 2001 From: heaven Date: Tue, 14 Apr 2026 02:18:51 +0300 Subject: [PATCH] localize Add Space --- public/locales/en.json | 53 +++++++++++++++++++ public/locales/ru.json | 53 +++++++++++++++++++ .../create-room/AdditionalCreatorInput.tsx | 12 +++-- .../create-room/CreateRoomAccessSelector.tsx | 14 ++--- .../create-room/CreateRoomAliasInput.tsx | 8 +-- .../create-room/CreateRoomTypeSelector.tsx | 10 ++-- .../create-room/RoomVersionSelector.tsx | 6 ++- .../features/create-room/CreateRoomModal.tsx | 4 +- src/app/features/create-space/CreateSpace.tsx | 26 ++++----- .../create-space/CreateSpaceModal.tsx | 4 +- src/app/features/lobby/SpaceItem.tsx | 17 +++--- src/app/pages/client/create/Create.tsx | 6 ++- src/app/pages/client/sidebar/CreateTab.tsx | 12 +++-- 13 files changed, 177 insertions(+), 48 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 98695262..d360962d 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -554,5 +554,58 @@ "join_error_unknown": "Failed to join. Unknown Error.", "view_error": "View Error", "cancel": "Cancel" + }, + + "Create": { + "add_space": "Add Space", + "create_space": "Create Space", + "create_space_desc": "Build a space for your community.", + "join_with_address": "Join with Address", + "join_with_address_desc": "Join an existing community.", + "new_space": "New Space", + + "access": "Access", + "name": "Name", + "topic_optional": "Topic (Optional)", + "options": "Options", + "advanced_options": "Advanced Options", + "knock_to_join": "Knock to Join", + "knock_to_join_desc": "Anyone can send a request to join this space.", + "allow_federation": "Allow Federation", + "allow_federation_desc": "Users from other servers can join.", + "create": "Create", + "rate_limited": "Server rate-limited your request for {{minutes}} minutes!", + + "access_restricted": "Restricted", + "access_restricted_desc": "Only members of the parent space can join.", + "access_private": "Private", + "access_private_desc": "Only people with an invite can join.", + "access_public": "Public", + "access_public_desc": "Anyone with the address can join.", + + "address_optional": "Address (Optional)", + "address_hint": "Pick a unique address to make it discoverable.", + "address_taken": "This address is already taken. Please choose a different one.", + + "founders": "Founders", + "founders_desc": "Privileged users assigned during creation. They have elevated control and can only be changed during an upgrade.", + "enter": "Enter", + "no_suggestions": "No Suggestions", + "no_suggestions_desc": "Enter a user ID and press Enter.", + + "version": "Version", + "versions": "Versions", + + "chat_room": "Chat Room", + "chat_room_desc": "Messages, photos, and videos.", + "voice_room": "Voice Room", + "voice_room_desc": "Live audio and video conversations.", + + "new_chat_room": "New Chat Room", + "new_voice_room": "New Voice Room", + + "existing_space": "Existing Space", + "add_room": "Add Room", + "existing_room": "Existing Room" } } diff --git a/public/locales/ru.json b/public/locales/ru.json index a506fb2b..661e2cb1 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -556,5 +556,58 @@ "join_error_unknown": "Не удалось присоединиться. Неизвестная ошибка.", "view_error": "Подробности", "cancel": "Отмена" + }, + + "Create": { + "add_space": "Добавить пространство", + "create_space": "Создать пространство", + "create_space_desc": "Создайте пространство для вашего сообщества.", + "join_with_address": "Присоединиться по адресу", + "join_with_address_desc": "Присоединиться к существующему сообществу.", + "new_space": "Новое пространство", + + "access": "Доступ", + "name": "Название", + "topic_optional": "Тема (необязательно)", + "options": "Параметры", + "advanced_options": "Дополнительные параметры", + "knock_to_join": "Запрос на вступление", + "knock_to_join_desc": "Любой может отправить запрос на вступление в это пространство.", + "allow_federation": "Разрешить федерацию", + "allow_federation_desc": "Пользователи с других серверов смогут присоединиться.", + "create": "Создать", + "rate_limited": "Сервер ограничил ваш запрос на {{minutes}} мин.!", + + "access_restricted": "Ограниченный", + "access_restricted_desc": "Могут присоединиться только участники родительского пространства.", + "access_private": "Приватный", + "access_private_desc": "Могут присоединиться только приглашённые.", + "access_public": "Публичный", + "access_public_desc": "Любой, у кого есть адрес, может присоединиться.", + + "address_optional": "Адрес (необязательно)", + "address_hint": "Выберите уникальный адрес, чтобы пространство можно было найти.", + "address_taken": "Этот адрес уже занят. Выберите другой.", + + "founders": "Основатели", + "founders_desc": "Привилегированные пользователи, назначенные при создании. Они имеют расширенные полномочия; изменить их можно только при обновлении пространства.", + "enter": "Добавить", + "no_suggestions": "Нет предложений", + "no_suggestions_desc": "Введите ID пользователя и нажмите Добавить.", + + "version": "Версия", + "versions": "Версии", + + "chat_room": "Чат-комната", + "chat_room_desc": "Сообщения, фото и видео.", + "voice_room": "Голосовая комната", + "voice_room_desc": "Голосовые и видеозвонки в реальном времени.", + + "new_chat_room": "Новая чат-комната", + "new_voice_room": "Новая голосовая комната", + + "existing_space": "Существующее пространство", + "add_room": "Добавить комнату", + "existing_room": "Существующая комната" } } diff --git a/src/app/components/create-room/AdditionalCreatorInput.tsx b/src/app/components/create-room/AdditionalCreatorInput.tsx index 84b92231..bd27fa7b 100644 --- a/src/app/components/create-room/AdditionalCreatorInput.tsx +++ b/src/app/components/create-room/AdditionalCreatorInput.tsx @@ -17,6 +17,7 @@ import { } from 'folds'; import { isKeyHotkey } from 'is-hotkey'; import FocusTrap from 'focus-trap-react'; +import { useTranslation } from 'react-i18next'; import React, { ChangeEventHandler, KeyboardEventHandler, @@ -83,6 +84,7 @@ export function AdditionalCreatorInput({ onRemove, disabled, }: AdditionalCreatorInputProps) { + const { t } = useTranslation(); const mx = useMatrixClient(); const [menuCords, setMenuCords] = useState(); const directUsers = useDirectUsers(); @@ -150,8 +152,8 @@ export function AdditionalCreatorInput({ return ( @@ -213,7 +215,7 @@ export function AdditionalCreatorInput({ onClick={handleEnterClick} disabled={!validUserId} > - Enter + {t('Create.enter')} @@ -263,10 +265,10 @@ export function AdditionalCreatorInput({ gap="100" > - No Suggestions + {t('Create.no_suggestions')} - Please provide the user ID and hit Enter. + {t('Create.no_suggestions_desc')} )} diff --git a/src/app/components/create-room/CreateRoomAccessSelector.tsx b/src/app/components/create-room/CreateRoomAccessSelector.tsx index 35f39af8..dc92429c 100644 --- a/src/app/components/create-room/CreateRoomAccessSelector.tsx +++ b/src/app/components/create-room/CreateRoomAccessSelector.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Box, Text, Icon, Icons, config, IconSrc } from 'folds'; +import { useTranslation } from 'react-i18next'; import { SequenceCard } from '../sequence-card'; import { SettingTile } from '../setting-tile'; import { CreateRoomAccess } from './types'; @@ -18,6 +19,7 @@ export function CreateRoomAccessSelector({ disabled, getIcon, }: CreateRoomAccessSelectorProps) { + const { t } = useTranslation(); return ( {canRestrict && ( @@ -36,9 +38,9 @@ export function CreateRoomAccessSelector({ before={} after={value === CreateRoomAccess.Restricted && } > - Restricted + {t('Create.access_restricted')} - Only member of parent space can join. + {t('Create.access_restricted_desc')} @@ -58,9 +60,9 @@ export function CreateRoomAccessSelector({ before={} after={value === CreateRoomAccess.Private && } > - Private + {t('Create.access_private')} - Only people with invite can join. + {t('Create.access_private_desc')} @@ -79,9 +81,9 @@ export function CreateRoomAccessSelector({ before={} after={value === CreateRoomAccess.Public && } > - Public + {t('Create.access_public')} - Anyone with the address can join. + {t('Create.access_public_desc')} diff --git a/src/app/components/create-room/CreateRoomAliasInput.tsx b/src/app/components/create-room/CreateRoomAliasInput.tsx index e84658c0..4716af29 100644 --- a/src/app/components/create-room/CreateRoomAliasInput.tsx +++ b/src/app/components/create-room/CreateRoomAliasInput.tsx @@ -9,6 +9,7 @@ import React, { import { MatrixError } from 'matrix-js-sdk'; import { Box, color, Icon, Icons, Input, Spinner, Text, toRem } from 'folds'; import { isKeyHotkey } from 'is-hotkey'; +import { useTranslation } from 'react-i18next'; import { getMxIdServer } from '../../utils/matrix'; import { useMatrixClient } from '../../hooks/useMatrixClient'; import { replaceSpaceWithDash } from '../../utils/common'; @@ -16,6 +17,7 @@ import { AsyncState, AsyncStatus, useAsync } from '../../hooks/useAsyncCallback' import { useDebounce } from '../../hooks/useDebounce'; export function CreateRoomAliasInput({ disabled }: { disabled?: boolean }) { + const { t } = useTranslation(); const mx = useMatrixClient(); const aliasInputRef = useRef(null); const [aliasAvail, setAliasAvail] = useState>({ @@ -78,9 +80,9 @@ export function CreateRoomAliasInput({ disabled }: { disabled?: boolean }) { return ( - Address (Optional) + {t('Create.address_optional')} - Pick an unique address to make it discoverable. + {t('Create.address_hint')} - This address is already taken. Please select a different one. + {t('Create.address_taken')} )} diff --git a/src/app/components/create-room/CreateRoomTypeSelector.tsx b/src/app/components/create-room/CreateRoomTypeSelector.tsx index b1f69c39..b408bf39 100644 --- a/src/app/components/create-room/CreateRoomTypeSelector.tsx +++ b/src/app/components/create-room/CreateRoomTypeSelector.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Box, Text, Icon, Icons, config, IconSrc } from 'folds'; +import { useTranslation } from 'react-i18next'; import { SequenceCard } from '../sequence-card'; import { SettingTile } from '../setting-tile'; import { CreateRoomType } from './types'; @@ -17,6 +18,7 @@ export function CreateRoomTypeSelector({ disabled, getIcon, }: CreateRoomTypeSelectorProps) { + const { t } = useTranslation(); return ( - Chat Room + {t('Create.chat_room')} - - Messages, photos, and videos. + - {t('Create.chat_room_desc')} @@ -61,10 +63,10 @@ export function CreateRoomTypeSelector({ > - Voice Room + {t('Create.voice_room')} - - Live audio and video conversations. + - {t('Create.voice_room_desc')} diff --git a/src/app/components/create-room/RoomVersionSelector.tsx b/src/app/components/create-room/RoomVersionSelector.tsx index 219ded0c..82038f2b 100644 --- a/src/app/components/create-room/RoomVersionSelector.tsx +++ b/src/app/components/create-room/RoomVersionSelector.tsx @@ -1,4 +1,5 @@ import React, { MouseEventHandler, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { Box, Button, @@ -28,6 +29,7 @@ export function RoomVersionSelector({ onChange: (value: string) => void; disabled?: boolean; }) { + const { t } = useTranslation(); const [menuCords, setMenuCords] = useState(); const handleMenu: MouseEventHandler = (evt) => { @@ -47,7 +49,7 @@ export function RoomVersionSelector({ gap="500" > - Versions + {t('Create.versions')} {versions.map((version) => ( - {type === CreateRoomType.VoiceRoom ? 'New Voice Room' : 'New Chat Room'} + {type === CreateRoomType.VoiceRoom ? t('Create.new_voice_room') : t('Create.new_chat_room')} diff --git a/src/app/features/create-space/CreateSpace.tsx b/src/app/features/create-space/CreateSpace.tsx index b0c12f56..741cdce4 100644 --- a/src/app/features/create-space/CreateSpace.tsx +++ b/src/app/features/create-space/CreateSpace.tsx @@ -14,6 +14,7 @@ import { Text, TextArea, } from 'folds'; +import { useTranslation } from 'react-i18next'; import { SettingTile } from '../../components/setting-tile'; import { SequenceCard } from '../../components/sequence-card'; import { @@ -52,6 +53,7 @@ type CreateSpaceFormProps = { onCreate?: (roomId: string) => void; }; export function CreateSpaceForm({ defaultAccess, space, onCreate }: CreateSpaceFormProps) { + const { t } = useTranslation(); const mx = useMatrixClient(); const alive = useAlive(); @@ -138,7 +140,7 @@ export function CreateSpaceForm({ defaultAccess, space, onCreate }: CreateSpaceF return ( - Access + {t('Create.access')} - Name + {t('Create.name')} } @@ -162,7 +164,7 @@ export function CreateSpaceForm({ defaultAccess, space, onCreate }: CreateSpaceF /> - Topic (Optional) + {t('Create.topic_optional')}