From fc8346e50ddc5a0dfe6e247e5f937a326fc3cf6a Mon Sep 17 00:00:00 2001 From: heaven Date: Tue, 14 Apr 2026 00:30:08 +0300 Subject: [PATCH] localize home --- public/locales/en.json | 37 +++++++++++++++++++ public/locales/ru.json | 37 +++++++++++++++++++ .../join-address-prompt/JoinAddressPrompt.tsx | 12 +++--- src/app/features/create-room/CreateRoom.tsx | 36 ++++++++++-------- src/app/features/room-nav/RoomNavItem.tsx | 20 ++++++---- src/app/pages/client/home/CreateRoom.tsx | 6 ++- src/app/pages/client/home/Home.tsx | 25 ++++++++----- src/app/pages/client/sidebar/HomeTab.tsx | 7 +++- 8 files changed, 137 insertions(+), 43 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index f0ce19b0..12a228f9 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -310,5 +310,42 @@ "event": "event", "open": "Open", "home": "Home" + }, + "Home": { + "home": "Home", + "mark_as_read": "Mark as Read", + "no_rooms": "No Rooms", + "no_rooms_desc": "You do not have any rooms yet.", + "create_room": "Create Room", + "create_room_subtitle": "Build a room for real-time conversations.", + "explore_community": "Explore Community Rooms", + "join_with_address": "Join by Address", + "join_address_desc": "Enter an address to join a room or space. Addresses look like:", + "address": "Address", + "invalid_address": "Invalid Address", + "message_search": "Message Search", + "rooms": "Rooms", + "type": "Type", + "access": "Access", + "name": "Name", + "topic_optional": "Topic (Optional)", + "options": "Options", + "advanced_options": "Advanced Options", + "e2e_encryption": "End-to-End Encryption", + "e2e_encryption_desc": "Once this feature is enabled, it can't be disabled after the room is created.", + "knock_to_join": "Knock to Join", + "knock_to_join_desc": "Anyone can send a request to join this room.", + "allow_federation": "Allow Federation", + "allow_federation_desc": "Users from other servers can join.", + "rate_limited": "Server rate-limited your request for {{minutes}} minutes!", + "create": "Create", + "notifications": "Notifications", + "invite": "Invite", + "copy_link": "Copy Link", + "room_settings": "Room Settings", + "leave_room": "Leave Room", + "toggle_chat": "Toggle Chat", + "live_count": "{{count}} Live", + "open": "Open" } } diff --git a/public/locales/ru.json b/public/locales/ru.json index 9c29867a..71c8e4da 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -310,5 +310,42 @@ "event": "событие", "open": "Открыть", "home": "Главная" + }, + "Home": { + "home": "Главная", + "mark_as_read": "Отметить прочитанным", + "no_rooms": "Нет комнат", + "no_rooms_desc": "У вас ещё нет комнат.", + "create_room": "Создать комнату", + "create_room_subtitle": "Создайте комнату для общения в реальном времени.", + "explore_community": "Обзор комнат сообщества", + "join_with_address": "Присоединиться по адресу", + "join_address_desc": "Введите адрес комнаты или пространства. Адреса выглядят так:", + "address": "Адрес", + "invalid_address": "Неверный адрес", + "message_search": "Поиск сообщений", + "rooms": "Комнаты", + "type": "Тип", + "access": "Доступ", + "name": "Название", + "topic_optional": "Тема (необязательно)", + "options": "Параметры", + "advanced_options": "Дополнительные параметры", + "e2e_encryption": "Сквозное шифрование", + "e2e_encryption_desc": "После включения эту функцию нельзя отключить после создания комнаты.", + "knock_to_join": "Запрос на вступление", + "knock_to_join_desc": "Любой может отправить запрос на вступление в эту комнату.", + "allow_federation": "Разрешить федерацию", + "allow_federation_desc": "Пользователи с других серверов могут присоединяться.", + "rate_limited": "Сервер ограничил частоту запросов на {{minutes}} мин.!", + "create": "Создать", + "notifications": "Уведомления", + "invite": "Пригласить", + "copy_link": "Копировать ссылку", + "room_settings": "Настройки комнаты", + "leave_room": "Покинуть комнату", + "toggle_chat": "Переключить чат", + "live_count": "{{count}} В эфире", + "open": "Открыть" } } diff --git a/src/app/components/join-address-prompt/JoinAddressPrompt.tsx b/src/app/components/join-address-prompt/JoinAddressPrompt.tsx index 50a89418..cc243a21 100644 --- a/src/app/components/join-address-prompt/JoinAddressPrompt.tsx +++ b/src/app/components/join-address-prompt/JoinAddressPrompt.tsx @@ -1,4 +1,5 @@ import React, { FormEventHandler, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import FocusTrap from 'focus-trap-react'; import { Dialog, @@ -26,6 +27,7 @@ type JoinAddressProps = { onCancel: () => void; }; export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) { + const { t } = useTranslation(); const [invalid, setInvalid] = useState(false); const handleSubmit: FormEventHandler = (evt) => { @@ -80,7 +82,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) { size="500" > - Join with Address + {t('Home.join_with_address')} @@ -95,7 +97,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) { > - Enter public address to join the community. Addresses looks like: + {t('Home.join_address_desc')}
  • #community:server
  • @@ -104,7 +106,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) {
    - Address + {t('Home.address')} {invalid && ( - Invalid Address + {t('Home.invalid_address')} )} diff --git a/src/app/features/create-room/CreateRoom.tsx b/src/app/features/create-room/CreateRoom.tsx index 94799f6e..2ff5021d 100644 --- a/src/app/features/create-room/CreateRoom.tsx +++ b/src/app/features/create-room/CreateRoom.tsx @@ -1,4 +1,5 @@ import React, { FormEventHandler, useCallback, useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { MatrixError, Room, JoinRule } from 'matrix-js-sdk'; import { Box, @@ -70,6 +71,7 @@ export function CreateRoomForm({ space, onCreate, }: CreateRoomFormProps) { + const { t } = useTranslation(); const mx = useMatrixClient(); const alive = useAlive(); @@ -162,7 +164,7 @@ export function CreateRoomForm({ {!space && ( - Type + {t('Home.type')} )} - Access + {t('Home.access')} - Name + {t('Home.name')} } @@ -196,7 +198,7 @@ export function CreateRoomForm({ /> - Topic (Optional) + {t('Home.topic_optional')}