Add Spanish and Polish

This commit is contained in:
Ash 2022-07-10 15:15:18 +08:00
parent f21a0c9fd8
commit 7bd78a3c04
6 changed files with 106 additions and 47 deletions

View File

@ -19,8 +19,9 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
object French : LanguagesPreference(4)
object Czech : LanguagesPreference(5)
object Italian : LanguagesPreference(6)
object Hindi : LanguagesPreference(7)
object Spanish : LanguagesPreference(8)
object Polish : LanguagesPreference(9)
override fun put(context: Context, scope: CoroutineScope) {
scope.launch {
@ -42,6 +43,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
Czech -> context.getString(R.string.czech)
Italian -> context.getString(R.string.italian)
Hindi -> context.getString(R.string.hindi)
Spanish -> context.getString(R.string.spanish)
Polish -> context.getString(R.string.polish)
}
fun getLocale(): Locale =
@ -54,6 +57,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
Czech -> Locale("cs", "CZ")
Italian -> Locale("it", "IT")
Hindi -> Locale("hi", "IN")
Spanish -> Locale("es", "ES")
Polish -> Locale("pl", "PL")
}
fun setLocale(context: Context) {
@ -78,7 +83,16 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
companion object {
val default = UseDeviceLanguages
val values = listOf(UseDeviceLanguages, English, ChineseSimplified, German, French, Czech, Italian, Hindi)
val values = listOf(UseDeviceLanguages,
English,
ChineseSimplified,
German,
French,
Czech,
Italian,
Hindi,
Spanish,
Polish)
fun fromPreferences(preferences: Preferences): LanguagesPreference =
when (preferences[DataStoreKeys.Languages.key]) {
@ -90,6 +104,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
5 -> Czech
6 -> Italian
7 -> Hindi
8 -> Spanish
9 -> Polish
else -> default
}
@ -103,6 +119,8 @@ sealed class LanguagesPreference(val value: Int) : Preference() {
5 -> Czech
6 -> Italian
7 -> Hindi
8 -> Spanish
9 -> Polish
else -> default
}
}

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@ -13,6 +14,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import me.ash.reader.ui.theme.palette.alwaysLight
import me.ash.reader.ui.theme.palette.onDark
@ -33,14 +35,17 @@ fun BlockButton(
.height(56.dp)
.clip(RoundedCornerShape(12.dp))
.background(if (selected) selectedContainerColor else containerColor)
.clickable(onClick = onClick),
.clickable(onClick = onClick)
.padding(horizontal = 5.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = text,
style = MaterialTheme.typography.labelLarge,
style = MaterialTheme.typography.labelLarge.copy(
textAlign = TextAlign.Center,
),
color = if (selected) selectedContentColor else contentColor,
)
}
}
}

View File

@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import me.ash.reader.R
@ -109,13 +110,14 @@ fun MarkAsReadBarItem(
}
) {
Box(
modifier = Modifier
.fillMaxHeight(),
modifier = Modifier.fillMaxHeight().padding(horizontal = 5.dp),
contentAlignment = Alignment.Center,
) {
Text(
text = text,
style = MaterialTheme.typography.titleSmall,
style = MaterialTheme.typography.titleSmall.copy(
textAlign = TextAlign.Center,
),
color = if (isPrimary) {
MaterialTheme.colorScheme.onSurface alwaysLight true
} else {
@ -127,4 +129,4 @@ fun MarkAsReadBarItem(
if (!isPrimary) {
Spacer(modifier = Modifier.width(8.dp))
}
}
}

View File

@ -1,5 +1,4 @@
<resources>
<string name="read_you" translatable="false">Read You</string>
<string name="all">Todo</string>
<plurals name="all_desc">
<item quantity="one">%1$d artículo archivado</item>
@ -60,7 +59,6 @@
<string name="all_move_to_group_toast">Movidas todas las fuentes al grupo \"%1$s\"</string>
<string name="rename">Renombrar</string>
<string name="change_url">Cambiar URL</string>
<string name="feed_url_placeholder" translatable="false">http://example.com/feed.rss</string>
<string name="rename_toast">Renombrar a \"%1$s\"</string>
<string name="create_new_group">Crear grupo nuevo</string>
<string name="name">Nombre</string>
@ -104,12 +102,6 @@
<string name="languages_desc">Inglés, Chino, más</string>
<string name="help_translate">Ayuda para traducir</string>
<string name="use_device_languages">Usar idioma del dispositivo</string>
<string name="english" translatable="false">English</string>
<string name="chinese_simplified" translatable="false">简体中文</string>
<string name="german" translatable="false">Deutsch</string>
<string name="french" translatable="false">Français</string>
<string name="czech" translatable="false">Čeština</string>
<string name="italian" translatable="false">Italiano</string>
<string name="tips_and_support">Consejos y ayuda</string>
<string name="tips_and_support_desc">Acerca de, licencias de código abierto</string>
<string name="welcome">Bienvenido</string>
@ -243,15 +235,13 @@
<string name="other">Otros</string>
<string name="amoled_dark_theme">Tema oscuro AMOLED</string>
<string name="tonal_elevation">Elevación del tono</string>
<string name="fonts">Tipos de letras</string>
<string name="reading_fonts">Letras lectura</string>
<string name="basic_fonts">Letras básicas</string>
<string name="feeds_page">Página de fuentes</string>
<string name="flow_page">Página de flujo</string>
<string name="reading_page">Página de lectura</string>
<string name="sponsor">Patrocinar</string>
<string name="open_source_licenses">Licencias de código abierto</string>
<string name="github_link" translatable="false">https://github.com/Ashinch/ReadYou</string>
<string name="telegram_link" translatable="false">https://t.me/ReadYouApp</string>
<string name="update_link">https://api.github.com/repos/Ashinch/ReadYou/releases/latest</string>
<string name="change_log">Registro de cambios</string>
<string name="update">Actualizar</string>
@ -271,7 +261,7 @@
</string>
<string name="preview_feed_name">Reddit</string>
<string name="value">valor</string>
<string name="padding_on_both_ends">Acolchado en ambos extremos</string>
<string name="horizontal_padding">Acolchado en ambos extremos</string>
<string name="article_date">Fecha de publicación del artículo</string>
<string name="article_desc">Descripciones del artículo</string>
<string name="article_images">Imágenes del artículo</string>
@ -294,4 +284,33 @@
<string name="tips_group_list_tonal_elevation">La elevación del tono solo está disponible para el tema claro.</string>
<string name="share">Compartir</string>
<string name="touch_to_play_video">Tocar para reproducir el video</string>
<string name="text">Text</string>
<string name="font_size">Font size</string>
<string name="letter_spacing">Letter spacing</string>
<string name="line_spacing">Line spacing</string>
<string name="alignment">Alignment</string>
<string name="general">General</string>
<string name="auto_hide_toolbars">Auto hide toolbars</string>
<string name="rearrange_buttons">Rearrange buttons</string>
<string name="bionic_reading">Bionic Reading</string>
<string name="images">Images</string>
<string name="rounded_corners">Rounded corners</string>
<string name="videos">Videos</string>
<string name="align_left">Align left</string>
<string name="align_right">Align right</string>
<string name="center_text">Center text</string>
<string name="justify">Justify</string>
<string name="external_fonts">External fonts</string>
<string name="title">Title</string>
<string name="bold">Bold</string>
<string name="upper_case">Upper case</string>
<string name="subhead">Subhead</string>
<string name="use_app_theme">Use app theme</string>
<string name="advanced">Advanced</string>
<string name="dark_reading_theme">Dark reading theme</string>
<string name="title_desc">Bold, upper case, alignment</string>
<string name="text_desc">Font size, letter spacing, alignment</string>
<string name="images_desc">Rounded corners, horizontal padding</string>
<string name="videos_desc">Rounded corners, horizontal padding</string>
<string name="maximize">Maximize</string>
</resources>

View File

@ -1,28 +1,21 @@
<resources>
<string name="read_you" translatable="false">Read You</string>
<string name="all">Wszystkie</string>
<plurals name="all_desc">
<item quantity="one">%1$d pobrany artykuł</item>
<item quantity="two">%1$d pobrane artykuły</item>
<item quantity="three">%1$d pobrane artykuły</item>
<item quantity="four">%1$d pobrane artykuły</item>
<item quantity="other">%1$d pobranych artykułów</item>
<item quantity="few">%1$d pobrane artykuły</item>
<item quantity="many">%1$d pobranych artykułów</item>
</plurals>
<string name="unread">Nieprzeczytane</string>
<plurals name="unread_desc">
<item quantity="one">%1$d nieprzeczytany artykuł</item>
<item quantity="two">%1$d nieprzeczytane artykuły</item>
<item quantity="three">%1$d nieprzeczytane artykuły</item>
<item quantity="four">%1$d nieprzeczytane artykuły</item>
<item quantity="other">%1$d nieprzeczytanych artykułów</item>
<item quantity="few">%1$d nieprzeczytane artykuły</item>
<item quantity="many">%1$d nieprzeczytanych artykułów</item>
</plurals>
<string name="starred">Wyróżnione</string>
<plurals name="starred_desc">
<item quantity="one">%1$d wyróżniony artykuł</item>
<item quantity="two">%1$d wyróżnione artykuły</item>
<item quantity="three">%1$d wyróżnione artykuły</item>
<item quantity="four">%1$d wyróżnione artykuły</item>
<item quantity="other">%1$d wyróżnionych artykułów</item>
<item quantity="few">%1$d wyróżnione artykuły</item>
<item quantity="many">%1$d wyróżnionych artykułów</item>
</plurals>
<string name="feeds">Kanały</string>
<string name="syncing">Synchronizacja…</string>
@ -69,7 +62,6 @@
<string name="all_move_to_group_toast">Przeniesiono wszystkie kanały do grupy \"%1$s\"</string>
<string name="rename">Zmień nazwę</string>
<string name="change_url">Zmień adres URL</string>
<string name="feed_url_placeholder" translatable="false">http://example.com/feed.rss</string>
<string name="rename_toast">Zmieniono nazwę na \"%1$s\"</string>
<string name="create_new_group">Utwórz nową grupę</string>
<string name="name">Nazwa</string>
@ -113,12 +105,6 @@
<string name="languages_desc">Angielski, Chiński i więcej </string>
<string name="help_translate">Pomóż w tłumaczeniu</string>
<string name="use_device_languages">Zgodny z systemem</string>
<string name="english" translatable="false">English</string>
<string name="chinese_simplified" translatable="false">简体中文</string>
<string name="german" translatable="false">Deutsch</string>
<string name="french" translatable="false">français</string>
<string name="czech" translatable="false">Čeština</string>
<string name="italian" translatable="false">italiano</string>
<string name="tips_and_support">Porady i wsparcie</string>
<string name="tips_and_support_desc">Informacje o aplikacji i licencjach open source</string>
<string name="welcome">Witamy</string>
@ -249,15 +235,13 @@
<string name="other">Inne</string>
<string name="amoled_dark_theme">Czarny motyw AMOLED</string>
<string name="tonal_elevation">Odcień</string>
<string name="fonts">Czcionki</string>
<string name="reading_fonts">Czytania czcionki</string>
<string name="basic_fonts">Podstawowe czcionki</string>
<string name="feeds_page">Strona kanałów</string>
<string name="flow_page">Strona flow</string>
<string name="reading_page">Strona czytania</string>
<string name="sponsor">Sponsor</string>
<string name="open_source_licenses">Licencje open source</string>
<string name="github_link" translatable="false">https://github.com/Ashinch/ReadYou</string>
<string name="telegram_link" translatable="false">https://t.me/ReadYouApp</string>
<string name="update_link">https://api.github.com/repos/Ashinch/ReadYou/releases/latest</string>
<string name="change_log">Lista zmian</string>
<string name="update">Aktualizuj</string>
@ -277,7 +261,7 @@
</string>
<string name="preview_feed_name">Reddit</string>
<string name="value">wartość</string>
<string name="padding_on_both_ends">Odstęp od krawędzi</string>
<string name="horizontal_padding">Odstęp od krawędzi</string>
<string name="article_date">Data publikacji artykułu</string>
<string name="article_desc">Opis artykuły</string>
<string name="article_images">Obraz z artykułu</string>
@ -300,4 +284,33 @@
<string name="tips_group_list_tonal_elevation">Ten odcień jest dostępny tylko w jasnym motywie.</string>
<string name="share">Udostępnij</string>
<string name="touch_to_play_video">Dotknij aby odtworzyć klip</string>
<string name="text">Text</string>
<string name="font_size">Font size</string>
<string name="letter_spacing">Letter spacing</string>
<string name="line_spacing">Line spacing</string>
<string name="alignment">Alignment</string>
<string name="general">General</string>
<string name="auto_hide_toolbars">Auto hide toolbars</string>
<string name="rearrange_buttons">Rearrange buttons</string>
<string name="bionic_reading">Bionic Reading</string>
<string name="images">Images</string>
<string name="rounded_corners">Rounded corners</string>
<string name="videos">Videos</string>
<string name="align_left">Align left</string>
<string name="align_right">Align right</string>
<string name="center_text">Center text</string>
<string name="justify">Justify</string>
<string name="external_fonts">External fonts</string>
<string name="title">Title</string>
<string name="bold">Bold</string>
<string name="upper_case">Upper case</string>
<string name="subhead">Subhead</string>
<string name="use_app_theme">Use app theme</string>
<string name="advanced">Advanced</string>
<string name="dark_reading_theme">Dark reading theme</string>
<string name="title_desc">Bold, upper case, alignment</string>
<string name="text_desc">Font size, letter spacing, alignment</string>
<string name="images_desc">Rounded corners, horizontal padding</string>
<string name="videos_desc">Rounded corners, horizontal padding</string>
<string name="maximize">Maximize</string>
</resources>

View File

@ -108,10 +108,12 @@
<string name="english" translatable="false">English</string>
<string name="chinese_simplified" translatable="false">简体中文</string>
<string name="german" translatable="false">Deutsch</string>
<string name="french" translatable="false">français</string>
<string name="french" translatable="false">Français</string>
<string name="czech" translatable="false">Čeština</string>
<string name="italian" translatable="false">italiano</string>
<string name="italian" translatable="false">Italiano</string>
<string name="hindi" translatable="false">हिंदी</string>
<string name="spanish" translatable="false">Español</string>
<string name="polish" translatable="false">Polski</string>
<string name="tips_and_support">Tips &amp; support</string>
<string name="tips_and_support_desc">About, open source licenses</string>
<string name="welcome">Welcome</string>