Add Russian (ru) translation

This commit is contained in:
Oleg Koretsky
2023-03-02 20:41:22 +02:00
parent 0da542fede
commit 0369b45385
8 changed files with 186 additions and 47 deletions

View File

@@ -21,7 +21,6 @@ import com.vitorpamplona.amethyst.service.relays.Client
import com.vitorpamplona.amethyst.ui.screen.AccountScreen import com.vitorpamplona.amethyst.ui.screen.AccountScreen
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
import com.vitorpamplona.amethyst.ui.theme.AmethystTheme import com.vitorpamplona.amethyst.ui.theme.AmethystTheme
import java.util.Locale
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View File

@@ -9,12 +9,11 @@ import android.os.Environment
import android.provider.MediaStore import android.provider.MediaStore
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.net.toUri import androidx.core.net.toUri
import java.io.File
import com.vitorpamplona.amethyst.R
import okhttp3.* import okhttp3.*
import okio.BufferedSource import okio.BufferedSource
import okio.IOException import okio.IOException
import okio.sink import okio.sink
import java.io.File
object ImageSaver { object ImageSaver {
@@ -50,7 +49,7 @@ object ImageSaver {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val contentType = response.header("Content-Type") val contentType = response.header("Content-Type")
checkNotNull(contentType) { checkNotNull(contentType) {
context.getString(R.string.can_t_find_out_the_content_type) "Can't find out the content type"
} }
saveContentQ( saveContentQ(
@@ -58,7 +57,6 @@ object ImageSaver {
contentType = contentType, contentType = contentType,
contentSource = response.body.source(), contentSource = response.body.source(),
contentResolver = context.contentResolver, contentResolver = context.contentResolver,
context = context
) )
} else { } else {
saveContentDefault( saveContentDefault(
@@ -82,7 +80,6 @@ object ImageSaver {
contentType: String, contentType: String,
contentSource: BufferedSource, contentSource: BufferedSource,
contentResolver: ContentResolver, contentResolver: ContentResolver,
context: Context
) { ) {
val contentValues = ContentValues().apply { val contentValues = ContentValues().apply {
put(MediaStore.MediaColumns.DISPLAY_NAME, displayName) put(MediaStore.MediaColumns.DISPLAY_NAME, displayName)
@@ -96,13 +93,13 @@ object ImageSaver {
val uri = val uri =
contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues) contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)
checkNotNull(uri) { checkNotNull(uri) {
context.getString(R.string.can_t_insert_the_new_content) "Can't insert the new content"
} }
try { try {
val outputStream = contentResolver.openOutputStream(uri) val outputStream = contentResolver.openOutputStream(uri)
checkNotNull(outputStream) { checkNotNull(outputStream) {
context.getString(R.string.can_t_open_the_content_output_stream) "Can't open the content output stream"
} }
outputStream.use { outputStream.use {

View File

@@ -1,23 +1,14 @@
package com.vitorpamplona.amethyst.ui.actions package com.vitorpamplona.amethyst.ui.actions
import android.content.ContentResolver import android.content.ContentResolver
import android.content.Context
import android.net.Uri import android.net.Uri
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import java.io.IOException import okhttp3.*
import java.util.UUID
import okhttp3.Call
import okhttp3.Callback
import okhttp3.MediaType
import com.vitorpamplona.amethyst.R
import okhttp3.MediaType.Companion.toMediaType import okhttp3.MediaType.Companion.toMediaType
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okio.BufferedSink import okio.BufferedSink
import okio.source import okio.source
import java.io.IOException
import java.util.*
object ImageUploader { object ImageUploader {
fun uploadImage( fun uploadImage(
@@ -25,7 +16,6 @@ object ImageUploader {
contentResolver: ContentResolver, contentResolver: ContentResolver,
onSuccess: (String) -> Unit, onSuccess: (String) -> Unit,
onError: (Throwable) -> Unit, onError: (Throwable) -> Unit,
context : Context
) { ) {
val contentType = contentResolver.getType(uri) val contentType = contentResolver.getType(uri)
@@ -43,7 +33,7 @@ object ImageUploader {
override fun writeTo(sink: BufferedSink) { override fun writeTo(sink: BufferedSink) {
val imageInputStream = contentResolver.openInputStream(uri) val imageInputStream = contentResolver.openInputStream(uri)
checkNotNull(imageInputStream) { checkNotNull(imageInputStream) {
context.getString(R.string.can_t_open_the_image_input_stream) "Can't open the image input stream"
} }
imageInputStream.source().use(sink::writeAll) imageInputStream.source().use(sink::writeAll)
@@ -66,7 +56,7 @@ object ImageUploader {
val tree = jacksonObjectMapper().readTree(body.string()) val tree = jacksonObjectMapper().readTree(body.string())
val url = tree?.get("data")?.get("link")?.asText() val url = tree?.get("data")?.get("link")?.asText()
checkNotNull(url) { checkNotNull(url) {
context.getString(R.string.there_must_be_an_uploaded_image_url_in_the_response) "There must be an uploaded image URL in the response"
} }
onSuccess(url) onSuccess(url)

View File

@@ -9,12 +9,7 @@ import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.TextFieldValue
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.*
import com.vitorpamplona.amethyst.model.LocalCache
import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.amethyst.model.parseDirtyWordForKey
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.components.isValidURL import com.vitorpamplona.amethyst.ui.components.isValidURL
import com.vitorpamplona.amethyst.ui.components.noProtocolUrlValidator import com.vitorpamplona.amethyst.ui.components.noProtocolUrlValidator
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
@@ -134,10 +129,9 @@ class NewPostViewModel: ViewModel() {
onError = { onError = {
isUploadingImage = false isUploadingImage = false
viewModelScope.launch { viewModelScope.launch {
imageUploadingError.emit(context.getString(R.string.failed_to_upload_the_image)) imageUploadingError.emit("Failed to upload the image")
} }
}, }
context = context
) )
} }

View File

@@ -59,11 +59,6 @@
<string name="error_parsing_preview_for">خطأ في تحليل المعاينة لـ %1$s : %2$s</string> <string name="error_parsing_preview_for">خطأ في تحليل المعاينة لـ %1$s : %2$s</string>
<string name="preview_card_image_for">معاينة صورة البطاقة لـ %1$s</string> <string name="preview_card_image_for">معاينة صورة البطاقة لـ %1$s</string>
<string name="new_channel">قناة جديدة</string> <string name="new_channel">قناة جديدة</string>
<string name="can_t_find_out_the_content_type">لا يمكن معرفة نوع المحتوى</string>
<string name="can_t_insert_the_new_content">لا يمكن إدراج المحتوى الجديد</string>
<string name="can_t_open_the_content_output_stream">لا يمكن فتح دفق إخراج المحتوى</string>
<string name="can_t_open_the_image_input_stream">لا يمكن فتح دفق إدخال الصورة</string>
<string name="there_must_be_an_uploaded_image_url_in_the_response">يجب أن يكون هناك عنوان URL للصورة التي تم تحميلها في الاستجابة</string>
<string name="channel_name">اسم القناة</string> <string name="channel_name">اسم القناة</string>
<string name="my_awesome_group">مجموعتي الرائعة</string> <string name="my_awesome_group">مجموعتي الرائعة</string>
<string name="picture_url">رابط الصورة</string> <string name="picture_url">رابط الصورة</string>

View File

@@ -59,11 +59,6 @@
<string name="error_parsing_preview_for">Erro ao analisar a visualização para %1$s: %2$s</string> <string name="error_parsing_preview_for">Erro ao analisar a visualização para %1$s: %2$s</string>
<string name="preview_card_image_for">Visualize a imagem do cartão para %1$s</string> <string name="preview_card_image_for">Visualize a imagem do cartão para %1$s</string>
<string name="new_channel">Novo Canal</string> <string name="new_channel">Novo Canal</string>
<string name="can_t_find_out_the_content_type">Não é possível descobrir o tipo de conteúdo</string>
<string name="can_t_insert_the_new_content">Não é possível inserir o novo conteúdo</string>
<string name="can_t_open_the_content_output_stream">Não é possível abrir o fluxo de saída de conteúdo</string>
<string name="can_t_open_the_image_input_stream">Não é possível abrir o fluxo de entrada de imagem</string>
<string name="there_must_be_an_uploaded_image_url_in_the_response">Deve haver um URL de imagem na resposta</string>
<string name="channel_name">Nome do Canal</string> <string name="channel_name">Nome do Canal</string>
<string name="my_awesome_group">Meu grupo</string> <string name="my_awesome_group">Meu grupo</string>
<string name="picture_url">Url da foto</string> <string name="picture_url">Url da foto</string>

View File

@@ -0,0 +1,174 @@
<resources>
<string name="app_name_release" translatable="false">Amethyst</string>
<string name="app_name_debug" translatable="false">Amethyst Debug</string>
<string name="point_to_the_qr_code">Наведите на QR код</string>
<string name="show_qr">Показать QR</string>
<string name="profile_image">Фото профиля</string>
<string name="scan_qr">Сканировать QR</string>
<string name="show_anyway">Показать</string>
<string name="post_was_flagged_as_inappropriate_by">Запись была помечена как неуместная</string>
<string name="post_not_found">запись не найдена</string>
<string name="channel_image">Фото канала</string>
<string name="referenced_event_not_found">Связанное событие не найдено</string>
<string name="could_not_decrypt_the_message">Не удалось расшифровать сообщение</string>
<string name="group_picture">Фото группы</string>
<string name="explicit_content">Откровенное содержание</string>
<string name="spam">Спам</string>
<string name="impersonation">Выдача себя за другое лицо</string>
<string name="illegal_behavior">Незаконные действия</string>
<string name="unknown">Неизвестно</string>
<string name="relay_icon">Иконка релея</string>
<string name="unknown_author">Неизвестный автор</string>
<string name="copy_text">Скопировать текст</string>
<string name="copy_user_pubkey">Скопировать ключ пользователя</string>
<string name="copy_note_id">Скопировать ID записи</string>
<string name="broadcast">Разослать</string>
<string name="block_hide_user">Блокировать и скрыть пользователя</string>
<string name="report_spam_scam">Сообщить о спаме / мошеничестве</string>
<string name="report_impersonation">Сообщить о выдаче себя за другое лицо</string>
<string name="report_explicit_content">Сообщить об откровенном содержании</string>
<string name="report_illegal_behaviour">Сообщить о незаконных действиях</string>
<string name="login_with_a_private_key_to_be_able_to_reply">Войдите с приватным ключом чтобы ответить</string>
<string name="login_with_a_private_key_to_be_able_to_boost_posts">Войдите с приватным ключом чтобы продвигать записи</string>
<string name="login_with_a_private_key_to_like_posts">Войдите с приватным ключом чтобы лайкать записи</string>
<string name="no_zap_amount_setup_long_press_to_change">Не настроены запы. Нажмите и удерживайте для настройки</string>
<string name="login_with_a_private_key_to_be_able_to_send_zaps">Войдите с приватным ключом чтобы запать</string>
<string name="zaps">Запы</string>
<string name="view_count">Просмотры</string>
<string name="boost">Продвинуть</string>
<string name="quote">Цитировать</string>
<string name="new_amount_in_sats">Новая сумма в sat</string>
<string name="add">Добавить</string>
<string name="replying_to">"в ответ "</string>
<string name="and">" и "</string>
<string name="in_channel">"в канале "</string>
<string name="profile_banner">Баннер профиля</string>
<string name="following">" Подписок"</string>
<string name="followers">" Подписчиков"</string>
<string name="profile">Профиль</string>
<string name="security_filters">Фильтры безопасности</string>
<string name="log_out">Выйти</string>
<string name="show_more">Больше</string>
<string name="lightning_invoice">Lightning инвойс</string>
<string name="pay">Оплатить</string>
<string name="lightning_tips">Lightning чаевые</string>
<string name="note_to_receiver">Заметка для получателя</string>
<string name="thank_you_so_much">Большое спасибо!</string>
<string name="amount_in_sats">Сумма в sat</string>
<string name="send_sats">Отправить</string>
<string name="never_translate_from">"Не переводить с "</string>
<string name="error_parsing_preview_for">"Не удалось создать предпросмотр для %1$s : %2$s"</string>
<string name="preview_card_image_for">"Предпросмотр для %1$s"</string>
<string name="new_channel">Новый канал</string>
<string name="channel_name">Название канала</string>
<string name="my_awesome_group">Моя новая группа</string>
<string name="picture_url">URL фотографии</string>
<string name="description">Описание</string>
<string name="about_us">"О нас.. "</string>
<string name="what_s_on_your_mind">Что нового?</string>
<string name="post">Опубликовать</string>
<string name="save">Сохранить</string>
<string name="create">Создать</string>
<string name="cancel">Отменить</string>
<string name="failed_to_upload_the_image">Не удалось загрузить фото</string>
<string name="relay_address">Адрес релея</string>
<string name="posts">Записи</string>
<string name="errors">Ошибки</string>
<string name="home_feed">Домашняя лента</string>
<string name="private_message_feed">Лента личных сообщений</string>
<string name="public_chat_feed">Лента чатов</string>
<string name="global_feed">Глобальная лента</string>
<string name="add_a_relay">Добавить релей</string>
<string name="display_name">Отображаемое имя</string>
<string name="my_display_name">Моё отображаемое имя</string>
<string name="username">Никнейм</string>
<string name="my_username">Мой никнейм</string>
<string name="about_me">Обо мне</string>
<string name="avatar_url">URL фотографии</string>
<string name="banner_url">URL баннера</string>
<string name="website_url">URL сайта</string>
<string name="ln_address">LN адрес</string>
<string name="ln_url_outdated">LN URL (устаревш.)</string>
<string name="image_saved_to_the_gallery">Фото сохранено в галерею</string>
<string name="failed_to_save_the_image">Не удалось сохранить фото</string>
<string name="upload_image">Загрузить\nфото</string>
<string name="uploading">Загрузка…</string>
<string name="user_does_not_have_a_lightning_address_setup_to_receive_sats">Пользователь не усталовил Lightning адрес для получения чаевых</string>
<string name="reply_here">"ответить.. "</string>
<string name="copies_the_note_id_to_the_clipboard_for_sharing">Копирует ID записи для отправки</string>
<string name="copy_channel_id_note_to_the_clipboard">Скопировать ID канала (записи)</string>
<string name="edits_the_channel_metadata">Редактирует метаданные канала</string>
<string name="join">Войти</string>
<string name="known">Известные</string>
<string name="new_requests">Новые запросы</string>
<string name="blocked_users">Заблокированные пользователи</string>
<string name="new_threads">Новые треды</string>
<string name="conversations">Обсуждения</string>
<string name="notes">Записи</string>
<string name="replies">Ответы</string>
<string name="follows">"Подписок"</string>
<string name="reports">"Жалоб"</string>
<string name="more_options">Больше опций</string>
<string name="relays">" Релеев"</string>
<string name="website">Сайт</string>
<string name="lightning_address">Lightning адрес</string>
<string name="copies_the_nsec_id_your_password_to_the_clipboard_for_backup">Копирует Nsec ID (ваш пароль) для резервного копирования</string>
<string name="copy_private_key_to_the_clipboard">Скопировать приватный ключ</string>
<string name="copies_the_public_key_to_the_clipboard_for_sharing">Копирует публичный ключ для отправки</string>
<string name="copy_public_key_npub_to_the_clipboard">Скопировать публичный ключ (NPub)</string>
<string name="send_a_direct_message">Отправить сообщение</string>
<string name="edits_the_user_s_metadata">Редактирует метаданные пользователя</string>
<string name="follow">Подписаться</string>
<string name="unblock">Разблокировать</string>
<string name="copy_user_id">Скопировать ID пользователя</string>
<string name="unblock_user">Разблокировать пользователя</string>
<string name="npub_hex_username">"npub, hex, никнейм "</string>
<string name="clear">Очистить</string>
<string name="app_logo">Логотип приложения</string>
<string name="nsec_npub_hex_private_key">nsec / npub / приватный ключ в hex</string>
<string name="show_password">Показать пароль</string>
<string name="hide_password">Скрыть пароль</string>
<string name="invalid_key">Некорректный ключ</string>
<string name="i_accept_the">"Я принимаю "</string>
<string name="terms_of_use">условия использования</string>
<string name="acceptance_of_terms_is_required">Нужно принять условия использования</string>
<string name="key_is_required">Нужно ввести ключ</string>
<string name="login">Войти</string>
<string name="generate_a_new_key">Сгенерировать ключ</string>
<string name="loading_feed">Загрузка ленты</string>
<string name="error_loading_replies">"Не удалось загрузить ответы: "</string>
<string name="try_again">Повторить</string>
<string name="feed_is_empty">Лента пуста.</string>
<string name="refresh">Обновить</string>
<string name="created">создал(а)</string>
<string name="with_description_of">с описанием</string>
<string name="and_picture">и фото</string>
<string name="changed_chat_name_to">сменил(а) название на</string>
<string name="description_to">описание на</string>
<string name="and_picture_to">и фото на</string>
<string name="leave">Выйти</string>
<string name="unfollow">Отписаться</string>
<string name="channel_created">Канал создан</string>
<string name="channel_information_changed_to">Информация о канале изменена на</string>
<string name="public_chat">Публичный чат</string>
<string name="posts_received">записей получено</string>
<string name="remove">Удалить</string>
<string name="auto">Автоматически</string>
<string name="translated_from">переведено с</string>
<string name="to">на</string>
<string name="show_in">Показать сперва на</string>
<string name="first" />
<string name="always_translate_to">Всегда переводить на</string>
<string name="nip_05" translatable="false">NIP-05</string>
<string name="lnurl" translatable="false">LNURL...</string>
<string name="never">никогда</string>
<string name="now">сейчас</string>
<string name="h">ч</string>
<string name="m">м</string>
<string name="d">д</string>
<string name="nudity">Нагота</string>
<string name="profanity_hateful_speech">Брань / Оскорбления</string>
<string name="report_hateful_speech">Сообщить об оскорблениях</string>
<string name="report_nudity_porn">Сообщить о наготе / порно</string>
<string name="others">других</string>
</resources>

View File

@@ -60,11 +60,6 @@
<string name="error_parsing_preview_for">"Error parsing preview for %1$s : %2$s"</string> <string name="error_parsing_preview_for">"Error parsing preview for %1$s : %2$s"</string>
<string name="preview_card_image_for">"Preview Card Image for %1$s"</string> <string name="preview_card_image_for">"Preview Card Image for %1$s"</string>
<string name="new_channel">New Channel</string> <string name="new_channel">New Channel</string>
<string name="can_t_find_out_the_content_type">Can\'t find out the content type</string>
<string name="can_t_insert_the_new_content">Can\'t insert the new content</string>
<string name="can_t_open_the_content_output_stream">Can\'t open the content output stream</string>
<string name="can_t_open_the_image_input_stream">Can\'t open the image input stream</string>
<string name="there_must_be_an_uploaded_image_url_in_the_response">There must be an uploaded image URL in the response</string>
<string name="channel_name">Channel Name</string> <string name="channel_name">Channel Name</string>
<string name="my_awesome_group">My Awesome Group</string> <string name="my_awesome_group">My Awesome Group</string>
<string name="picture_url">Picture Url</string> <string name="picture_url">Picture Url</string>