Poll history : use localazy strings

This commit is contained in:
ganfra 2023-12-12 14:36:07 +01:00
parent 424e9e266e
commit e5080765b2
9 changed files with 81 additions and 66 deletions

View file

@ -38,10 +38,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme import io.element.android.compound.theme.ElementTheme
import io.element.android.features.poll.api.pollcontent.PollContentView import io.element.android.features.poll.api.pollcontent.PollContentView
import io.element.android.features.poll.impl.R
import io.element.android.features.poll.impl.history.model.PollHistoryFilter import io.element.android.features.poll.impl.history.model.PollHistoryFilter
import io.element.android.features.poll.impl.history.model.PollHistoryItem import io.element.android.features.poll.impl.history.model.PollHistoryItem
import io.element.android.libraries.designsystem.components.button.BackButton import io.element.android.libraries.designsystem.components.button.BackButton
@ -55,6 +57,7 @@ import io.element.android.libraries.designsystem.theme.components.Surface
import io.element.android.libraries.designsystem.theme.components.Text import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.theme.components.TopAppBar import io.element.android.libraries.designsystem.theme.components.TopAppBar
import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@ -84,7 +87,7 @@ fun PollHistoryView(
TopAppBar( TopAppBar(
title = { title = {
Text( Text(
text = "Polls", // TODO Polls: Localazy text = stringResource(R.string.screen_polls_history_title),
style = ElementTheme.typography.aliasScreenTitle, style = ElementTheme.typography.aliasScreenTitle,
) )
}, },
@ -149,7 +152,7 @@ private fun PollHistoryFilterButtons(
count = PollHistoryFilter.entries.size, count = PollHistoryFilter.entries.size,
selected = activeFilter == filter, selected = activeFilter == filter,
onClick = { onFilterSelected(filter) }, onClick = { onFilterSelected(filter) },
text = filter.name text = stringResource(filter.stringResource),
) )
} }
} }
@ -184,7 +187,7 @@ private fun PollHistoryList(
if (hasMoreToLoad) { if (hasMoreToLoad) {
item { item {
Button( Button(
text = "Load more", text = stringResource(CommonStrings.action_load_more),
showProgress = isLoading, showProgress = isLoading,
onClick = onLoadMore, onClick = onLoadMore,
modifier = Modifier.padding(vertical = 24.dp), modifier = Modifier.padding(vertical = 24.dp),

View file

@ -16,7 +16,9 @@
package io.element.android.features.poll.impl.history.model package io.element.android.features.poll.impl.history.model
enum class PollHistoryFilter { import io.element.android.features.poll.impl.R
ONGOING,
PAST, enum class PollHistoryFilter(val stringResource: Int) {
ONGOING(R.string.screen_polls_history_filter_ongoing),
PAST(R.string.screen_polls_history_filter_past),
} }

View file

@ -11,4 +11,9 @@
<string name="screen_edit_poll_delete_confirmation">"Are you sure you want to delete this poll?"</string> <string name="screen_edit_poll_delete_confirmation">"Are you sure you want to delete this poll?"</string>
<string name="screen_edit_poll_delete_confirmation_title">"Delete Poll"</string> <string name="screen_edit_poll_delete_confirmation_title">"Delete Poll"</string>
<string name="screen_edit_poll_title">"Edit poll"</string> <string name="screen_edit_poll_title">"Edit poll"</string>
<string name="screen_polls_history_empty_ongoing">"Can\'t find any ongoing polls."</string>
<string name="screen_polls_history_empty_past">"Can\'t find any past polls."</string>
<string name="screen_polls_history_filter_ongoing">"Ongoing"</string>
<string name="screen_polls_history_filter_past">"Past"</string>
<string name="screen_polls_history_title">"Polls"</string>
</resources> </resources>

View file

@ -29,6 +29,7 @@ If you proceed, some of your settings may change."</string>
<string name="screen_notification_settings_enable_notifications">"Enable notifications on this device"</string> <string name="screen_notification_settings_enable_notifications">"Enable notifications on this device"</string>
<string name="screen_notification_settings_failed_fixing_configuration">"The configuration has not been corrected, please try again."</string> <string name="screen_notification_settings_failed_fixing_configuration">"The configuration has not been corrected, please try again."</string>
<string name="screen_notification_settings_group_chats">"Group chats"</string> <string name="screen_notification_settings_group_chats">"Group chats"</string>
<string name="screen_notification_settings_invite_for_me_label">"Invitations"</string>
<string name="screen_notification_settings_mentions_only_disclaimer">"Your homeserver does not support this option in encrypted rooms, you may not get notified in some rooms."</string> <string name="screen_notification_settings_mentions_only_disclaimer">"Your homeserver does not support this option in encrypted rooms, you may not get notified in some rooms."</string>
<string name="screen_notification_settings_mentions_section_title">"Mentions"</string> <string name="screen_notification_settings_mentions_section_title">"Mentions"</string>
<string name="screen_notification_settings_mode_all">"All"</string> <string name="screen_notification_settings_mode_all">"All"</string>

View file

@ -385,7 +385,7 @@ private fun PollsSection(
) { ) {
PreferenceCategory(modifier = modifier) { PreferenceCategory(modifier = modifier) {
ListItem( ListItem(
headlineContent = { Text("Polls") }, // TODO Polls: Localazy headlineContent = { Text(stringResource(R.string.screen_polls_history_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls)), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls)),
onClick = openPollHistory, onClick = openPollHistory,
) )

View file

@ -5,6 +5,7 @@
<item quantity="other">"%1$d people"</item> <item quantity="other">"%1$d people"</item>
</plurals> </plurals>
<string name="screen_notification_settings_edit_failed_updating_default_mode">"An error occurred while updating the notification setting."</string> <string name="screen_notification_settings_edit_failed_updating_default_mode">"An error occurred while updating the notification setting."</string>
<string name="screen_polls_history_title">"Polls"</string>
<string name="screen_room_details_add_topic_title">"Add topic"</string> <string name="screen_room_details_add_topic_title">"Add topic"</string>
<string name="screen_room_details_already_a_member">"Already a member"</string> <string name="screen_room_details_already_a_member">"Already a member"</string>
<string name="screen_room_details_already_invited">"Already invited"</string> <string name="screen_room_details_already_invited">"Already invited"</string>

View file

@ -3,6 +3,8 @@
<string name="screen_session_verification_cancelled_subtitle">"Something doesnt seem right. Either the request timed out or the request was denied."</string> <string name="screen_session_verification_cancelled_subtitle">"Something doesnt seem right. Either the request timed out or the request was denied."</string>
<string name="screen_session_verification_compare_emojis_subtitle">"Confirm that the emojis below match those shown on your other session."</string> <string name="screen_session_verification_compare_emojis_subtitle">"Confirm that the emojis below match those shown on your other session."</string>
<string name="screen_session_verification_compare_emojis_title">"Compare emojis"</string> <string name="screen_session_verification_compare_emojis_title">"Compare emojis"</string>
<string name="screen_session_verification_compare_numbers_subtitle">"Confirm that the numbers below match those shown on your other session."</string>
<string name="screen_session_verification_compare_numbers_title">"Compare numbers"</string>
<string name="screen_session_verification_complete_subtitle">"Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted."</string> <string name="screen_session_verification_complete_subtitle">"Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted."</string>
<string name="screen_session_verification_open_existing_session_subtitle">"Prove its you in order to access your encrypted message history."</string> <string name="screen_session_verification_open_existing_session_subtitle">"Prove its you in order to access your encrypted message history."</string>
<string name="screen_session_verification_open_existing_session_title">"Open an existing session"</string> <string name="screen_session_verification_open_existing_session_title">"Open an existing session"</string>

View file

@ -95,6 +95,7 @@
<string name="action_try_again">"Try again"</string> <string name="action_try_again">"Try again"</string>
<string name="action_view_source">"View source"</string> <string name="action_view_source">"View source"</string>
<string name="action_yes">"Yes"</string> <string name="action_yes">"Yes"</string>
<string name="action_load_more">"Load more"</string>
<string name="common_about">"About"</string> <string name="common_about">"About"</string>
<string name="common_acceptable_use_policy">"Acceptable use policy"</string> <string name="common_acceptable_use_policy">"Acceptable use policy"</string>
<string name="common_advanced_settings">"Advanced settings"</string> <string name="common_advanced_settings">"Advanced settings"</string>
@ -109,6 +110,7 @@
<string name="common_dark">"Dark"</string> <string name="common_dark">"Dark"</string>
<string name="common_decryption_error">"Decryption error"</string> <string name="common_decryption_error">"Decryption error"</string>
<string name="common_developer_options">"Developer options"</string> <string name="common_developer_options">"Developer options"</string>
<string name="common_direct_chat">"Direct chat"</string>
<string name="common_edited_suffix">"(edited)"</string> <string name="common_edited_suffix">"(edited)"</string>
<string name="common_editing">"Editing"</string> <string name="common_editing">"Editing"</string>
<string name="common_emote">"* %1$s %2$s"</string> <string name="common_emote">"* %1$s %2$s"</string>
@ -227,9 +229,6 @@
<item quantity="other">"%d votes"</item> <item quantity="other">"%d votes"</item>
</plurals> </plurals>
<string name="preference_rageshake">"Rageshake to report bug"</string> <string name="preference_rageshake">"Rageshake to report bug"</string>
<string name="screen_edit_poll_delete_confirmation">"Are you sure you want to delete this poll?"</string>
<string name="screen_edit_poll_delete_confirmation_title">"Delete Poll"</string>
<string name="screen_edit_poll_title">"Edit poll"</string>
<string name="screen_media_picker_error_failed_selection">"Failed selecting media, please try again."</string> <string name="screen_media_picker_error_failed_selection">"Failed selecting media, please try again."</string>
<string name="screen_media_upload_preview_error_failed_processing">"Failed processing media to upload, please try again."</string> <string name="screen_media_upload_preview_error_failed_processing">"Failed processing media to upload, please try again."</string>
<string name="screen_media_upload_preview_error_failed_sending">"Failed uploading media, please try again."</string> <string name="screen_media_upload_preview_error_failed_sending">"Failed uploading media, please try again."</string>

View file

@ -115,7 +115,8 @@
"screen_room_member_list_.*", "screen_room_member_list_.*",
"screen_dm_details_.*", "screen_dm_details_.*",
"screen_room_notification_settings_.*", "screen_room_notification_settings_.*",
"screen_notification_settings_edit_failed_updating_default_mode" "screen_notification_settings_edit_failed_updating_default_mode",
"screen_polls_history_title"
] ]
}, },
{ {
@ -158,7 +159,8 @@
"name" : ":features:poll:impl", "name" : ":features:poll:impl",
"includeRegex" : [ "includeRegex" : [
"screen_create_poll_.*", "screen_create_poll_.*",
"screen_edit_poll_.*" "screen_edit_poll_.*",
"screen_polls_history_.*"
] ]
}, },
{ {