-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻️ Add a translate button to the session details screen. #981
♻️ Add a translate button to the session details screen. #981
Conversation
Hi @Corvus400! Codes seem to be unformatted. To resolve this issue, please run |
I need to fix the Swift code, but I couldn't fix it with my knowledge. |
diff --git a/app-ios/Modules/Sources/Session/SessionView.swift b/app-ios/Modules/Sources/Session/SessionView.swift
index 87f79e2a..7531d030 100644
--- a/app-ios/Modules/Sources/Session/SessionView.swift
+++ b/app-ios/Modules/Sources/Session/SessionView.swift
@@ -65,12 +65,12 @@ public struct SessionView: View {
if let session = viewModel.timetableItem as? TimetableItem.Session {
VStack(alignment: .leading, spacing: 16) {
- Text(session.description_)
+ Text(session.description_.currentLangTitle)
.textSelection(.enabled)
.lineLimit(isDescriptionExpanded ? nil : 5)
.background {
ViewThatFits(in: .vertical) {
- Text(session.description_)
+ Text(session.description_.currentLangTitle)
.hidden()
// Just for receiving onAppear event if the description exceeds its line limit
Color.clear
|
@woxtu |
@@ -117,8 +117,14 @@ fun SessionsAllResponse.Companion.fake(): SessionsAllResponse { | |||
en = "DroidKaigi App Architecture day$day room${room.name.en} index$index", | |||
), | |||
speakers = listOf("1", "2"), | |||
description = "これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n" + | |||
"これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n", | |||
description = "\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\" +\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -52,9 +54,14 @@ class TimetableItemDetailViewModel @Inject constructor( | |||
) | |||
private val viewBookmarkListRequestStateFlow = | |||
MutableStateFlow<ViewBookmarkListRequestState>(ViewBookmarkListRequestState.NotRequested) | |||
private val currentDescriptionLanguage = MutableStateFlow(defaultLang()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I was hoping that the session would be displayed in its original default language. The reason is that it would reflect what the speaker actually wrote. 👀
Maybe you can have userSelectedDescriptionLanguage = MutableStateFlow(null)
@@ -119,6 +119,12 @@ fun SessionsAllResponse.Companion.fake(): SessionsAllResponse { | |||
speakers = listOf("1", "2"), | |||
description = "これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n" + | |||
"これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n", | |||
i18nDesc = LocaledResponse( | |||
ja = "\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\" +\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think \\n
should be \n 👀
You can work on this another PR!
@@ -52,18 +53,28 @@ class TimetableItemDetailViewModel @Inject constructor( | |||
) | |||
private val viewBookmarkListRequestStateFlow = | |||
MutableStateFlow<ViewBookmarkListRequestState>(ViewBookmarkListRequestState.NotRequested) | |||
private val currentDescriptionLanguageStateFlow: MutableStateFlow<Lang?> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you name this variable selectedDescriptionLanguageStateFlow? I think currentDescriptionLanguageStateFlow is a little wrong name because if it is null, we show the sessions default lang 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for your suggestion! We may not have this feature without you!
Issue
Overview (Required)
Links
Screenshot (Optional if screenshot test is present or unrelated to UI)
Movie (Optional)
translate.mp4