From 27ea36f1ae39693bbdb51c4d90e2a126551c8fc0 Mon Sep 17 00:00:00 2001 From: takahirom Date: Sun, 28 Jul 2024 19:13:35 +0900 Subject: [PATCH] Migrate string resource from string class --- .../values-ja/about_strings.xml | 22 ++++++ .../composeResources/values/about_strings.xml | 22 ++++++ .../droidkaigi/confsched/about/AboutRes.kt | 8 +++ .../about/component/AboutContentColumn.kt | 6 +- .../AboutDroidKaigiDetailSummaryCard.kt | 15 ++-- .../confsched/about/section/AboutCredits.kt | 17 ++--- .../about/section/AboutDroidKaigiDetail.kt | 6 +- .../about/section/AboutFooterLinks.kt | 12 ++-- .../confsched/about/section/AboutOthers.kt | 18 ++--- .../confsched/about/strings/AboutStrings.kt | 71 ------------------- .../values-ja/sessions_strings.xml | 29 ++++++++ .../composeResources/values-ja/strings.xml | 5 -- .../values/sessions_strings.xml | 29 ++++++++ .../composeResources/values/strings.xml | 5 -- .../sessions/TimetableItemDetailPresenter.kt | 11 +-- .../confsched/sessions/TimetableScreen.kt | 4 +- .../component/TimeTableItemDetailContent.kt | 20 ++++-- .../TimeTableItemDetailSummaryCard.kt | 14 ++-- .../TimetableItemDetailBottomAppBar.kt | 7 +- .../component/TimetableItemDetailTopAppBar.kt | 8 ++- .../sessions/section/TimetableList.kt | 11 ++- .../sessions/section/TimetableSheet.kt | 5 +- .../strings/TimetableItemDetailStrings.kt | 26 ------- 23 files changed, 212 insertions(+), 159 deletions(-) create mode 100644 feature/about/src/commonMain/composeResources/values-ja/about_strings.xml create mode 100644 feature/about/src/commonMain/composeResources/values/about_strings.xml create mode 100644 feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutRes.kt delete mode 100644 feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/strings/AboutStrings.kt create mode 100644 feature/sessions/src/commonMain/composeResources/values-ja/sessions_strings.xml delete mode 100644 feature/sessions/src/commonMain/composeResources/values-ja/strings.xml create mode 100644 feature/sessions/src/commonMain/composeResources/values/sessions_strings.xml delete mode 100644 feature/sessions/src/commonMain/composeResources/values/strings.xml delete mode 100644 feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/strings/TimetableItemDetailStrings.kt diff --git a/feature/about/src/commonMain/composeResources/values-ja/about_strings.xml b/feature/about/src/commonMain/composeResources/values-ja/about_strings.xml new file mode 100644 index 000000000..3e8d0a75f --- /dev/null +++ b/feature/about/src/commonMain/composeResources/values-ja/about_strings.xml @@ -0,0 +1,22 @@ + + + DroidKaigiはAndroid技術情報の共有とコミュニケーションを目的に開催されるエンジニアが主役のAndroidカンファレンスです。 + 日時 + 2024.09.11(水) 〜 13(金) + 場所 + ベルサール渋谷ガーデン + 地図を見る + Credits + スタッフ + コントリビューター + スポンサー + Others + 行動規範 + ライセンス + プライバシーポリシー + アプリバージョン + YouTube + X + Medium + The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. + diff --git a/feature/about/src/commonMain/composeResources/values/about_strings.xml b/feature/about/src/commonMain/composeResources/values/about_strings.xml new file mode 100644 index 000000000..acf71b163 --- /dev/null +++ b/feature/about/src/commonMain/composeResources/values/about_strings.xml @@ -0,0 +1,22 @@ + + + DroidKaigi is a conference tailored for Android developers. + Date + 2024.09.11(Wed) - 13(Fri) + Place + Bellesalle Shibuya Garden + View Map + Credits + Staff + Contributor + Sponsor + Others + Code Of Conduct + License + Privacy Policy + App Version + YouTube + X + Medium + The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. + diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutRes.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutRes.kt new file mode 100644 index 000000000..5ce72b016 --- /dev/null +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutRes.kt @@ -0,0 +1,8 @@ +package io.github.droidkaigi.confsched.about + +import conference_app_2024.feature.about.generated.resources.Res + +object AboutRes { + val string = Res.string + val drawable = Res.drawable +} diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutContentColumn.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutContentColumn.kt index 996092feb..3ed3336f1 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutContentColumn.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutContentColumn.kt @@ -20,8 +20,10 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp -import io.github.droidkaigi.confsched.about.strings.AboutStrings +import conference_app_2024.feature.about.generated.resources.staff +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -81,7 +83,7 @@ fun AboutContentColumnPreview() { Surface { AboutContentColumn( leadingIcon = Outlined.SentimentVerySatisfied, - label = AboutStrings.Staff.asString(), + label = stringResource(AboutRes.string.staff), testTag = "", onClickAction = {}, ) diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutDroidKaigiDetailSummaryCard.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutDroidKaigiDetailSummaryCard.kt index 3ed870b6c..8a33a2b1b 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutDroidKaigiDetailSummaryCard.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/component/AboutDroidKaigiDetailSummaryCard.kt @@ -16,8 +16,13 @@ import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import io.github.droidkaigi.confsched.about.strings.AboutStrings +import conference_app_2024.feature.about.generated.resources.date_description +import conference_app_2024.feature.about.generated.resources.date_title +import conference_app_2024.feature.about.generated.resources.place_description +import conference_app_2024.feature.about.generated.resources.place_title +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -41,13 +46,13 @@ fun AboutDroidKaigiDetailSummaryCard( ) { AboutDroidKaigiDetailSummaryCardRow( leadingIcon = Outlined.Schedule, - label = AboutStrings.DateTitle.asString(), - content = AboutStrings.DateDescription.asString(), + label = stringResource(AboutRes.string.date_title), + content = stringResource(AboutRes.string.date_description), ) AboutDroidKaigiDetailSummaryCardRow( leadingIcon = Outlined.Place, - label = AboutStrings.PlaceTitle.asString(), - content = AboutStrings.PlaceDescription.asString(), + label = stringResource(AboutRes.string.place_title), + content = stringResource(AboutRes.string.place_description), ) } } diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutCredits.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutCredits.kt index 32db5d3f5..d4853f254 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutCredits.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutCredits.kt @@ -10,11 +10,12 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import conference_app_2024.feature.about.generated.resources.contributor +import conference_app_2024.feature.about.generated.resources.credits_title +import conference_app_2024.feature.about.generated.resources.staff +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.about.component.AboutContentColumn -import io.github.droidkaigi.confsched.about.strings.AboutStrings -import io.github.droidkaigi.confsched.about.strings.AboutStrings.Contributor -import io.github.droidkaigi.confsched.about.strings.AboutStrings.Sponsor -import io.github.droidkaigi.confsched.about.strings.AboutStrings.Staff +import org.jetbrains.compose.resources.stringResource const val AboutCreditsStaffItemTestTag = "AboutCreditsStaffItem" const val AboutCreditsContributorsItemTestTag = "AboutCreditsContributorsItem" @@ -28,7 +29,7 @@ fun LazyListScope.aboutCredits( ) { item { Text( - text = AboutStrings.CreditsTitle.asString(), + text = stringResource(AboutRes.string.credits_title), style = MaterialTheme.typography.titleMedium, modifier = modifier .padding( @@ -41,7 +42,7 @@ fun LazyListScope.aboutCredits( item { AboutContentColumn( leadingIcon = Outlined.Diversity1, - label = Contributor.asString(), + label = stringResource(AboutRes.string.contributor), testTag = AboutCreditsContributorsItemTestTag, onClickAction = onContributorsItemClick, modifier = modifier @@ -53,7 +54,7 @@ fun LazyListScope.aboutCredits( item { AboutContentColumn( leadingIcon = Outlined.SentimentVerySatisfied, - label = Staff.asString(), + label = stringResource(AboutRes.string.staff), testTag = AboutCreditsStaffItemTestTag, onClickAction = onStaffItemClick, modifier = modifier @@ -65,7 +66,7 @@ fun LazyListScope.aboutCredits( item { AboutContentColumn( leadingIcon = Outlined.Apartment, - label = Sponsor.asString(), + label = stringResource(AboutRes.string.staff), testTag = AboutCreditsSponsorsItemTestTag, onClickAction = onSponsorsItemClick, modifier = modifier diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutDroidKaigiDetail.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutDroidKaigiDetail.kt index 4348c6bca..21f9292c2 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutDroidKaigiDetail.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutDroidKaigiDetail.kt @@ -15,11 +15,13 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import conference_app_2024.feature.about.generated.resources.Res import conference_app_2024.feature.about.generated.resources.about_header +import conference_app_2024.feature.about.generated.resources.description +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.about.AboutTestTag import io.github.droidkaigi.confsched.about.component.AboutDroidKaigiDetailSummaryCard -import io.github.droidkaigi.confsched.about.strings.AboutStrings import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import org.jetbrains.compose.resources.painterResource +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -38,7 +40,7 @@ fun AboutDroidKaigiDetail( .padding(16.dp), ) Text( - text = AboutStrings.Description.asString(), + text = stringResource(AboutRes.string.description), style = MaterialTheme.typography.bodyLarge, textAlign = TextAlign.Center, modifier = Modifier diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutFooterLinks.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutFooterLinks.kt index 90f0332dd..313be043a 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutFooterLinks.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutFooterLinks.kt @@ -17,9 +17,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import conference_app_2024.feature.about.generated.resources.app_version +import conference_app_2024.feature.about.generated.resources.content_description_youtube +import conference_app_2024.feature.about.generated.resources.license +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.about.component.AboutFooterLinksIcon -import io.github.droidkaigi.confsched.about.strings.AboutStrings import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview const val AboutFooterLinksYouTubeItemTestTag = "AboutFooterLinksYouTubeItem" @@ -47,7 +51,7 @@ fun AboutFooterLinks( Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) { AboutFooterLinksIcon( testTag = AboutFooterLinksYouTubeItemTestTag, - contentDescription = "YouTube", + contentDescription = stringResource(AboutRes.string.content_description_youtube), onClick = onYouTubeClick, ) AboutFooterLinksIcon( @@ -63,7 +67,7 @@ fun AboutFooterLinks( } Spacer(modifier = Modifier.height(24.dp)) Text( - text = AboutStrings.AppVersion.asString(), + text = stringResource(AboutRes.string.app_version), style = MaterialTheme.typography.labelLarge, ) if (versionName != null) { @@ -76,7 +80,7 @@ fun AboutFooterLinks( Spacer(modifier = Modifier.height(8.dp)) Text( modifier = Modifier.padding(horizontal = 12.dp), - text = AboutStrings.LicenceDescription.asString(), + text = stringResource(AboutRes.string.license), style = MaterialTheme.typography.labelSmall, textAlign = TextAlign.Center, color = if (isSystemInDarkTheme()) licenseDescriptionDark else licenseDescriptionLight, diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt index 156ca8c21..95d2554ea 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt @@ -13,12 +13,14 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import conference_app_2024.feature.about.generated.resources.code_of_conduct +import conference_app_2024.feature.about.generated.resources.license +import conference_app_2024.feature.about.generated.resources.others_title +import conference_app_2024.feature.about.generated.resources.privacy_policy +import io.github.droidkaigi.confsched.about.AboutRes import io.github.droidkaigi.confsched.about.component.AboutContentColumn -import io.github.droidkaigi.confsched.about.strings.AboutStrings -import io.github.droidkaigi.confsched.about.strings.AboutStrings.CodeOfConduct -import io.github.droidkaigi.confsched.about.strings.AboutStrings.License -import io.github.droidkaigi.confsched.about.strings.AboutStrings.PrivacyPolicy import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview const val AboutOthersCodeOfConductItemTestTag = "AboutOthersCodeOfConductItem" @@ -33,7 +35,7 @@ fun LazyListScope.aboutOthers( ) { item { Text( - text = AboutStrings.OthersTitle.asString(), + text = stringResource(AboutRes.string.others_title), style = MaterialTheme.typography.titleMedium, modifier = modifier .padding( @@ -46,7 +48,7 @@ fun LazyListScope.aboutOthers( item { AboutContentColumn( leadingIcon = Outlined.Gavel, - label = CodeOfConduct.asString(), + label = stringResource(AboutRes.string.code_of_conduct), testTag = AboutOthersCodeOfConductItemTestTag, onClickAction = onCodeOfConductItemClick, modifier = modifier @@ -58,7 +60,7 @@ fun LazyListScope.aboutOthers( item { AboutContentColumn( leadingIcon = Outlined.FileCopy, - label = License.asString(), + label = stringResource(AboutRes.string.license), testTag = AboutOthersLicenseItemTestTag, onClickAction = onLicenseItemClick, modifier = modifier @@ -70,7 +72,7 @@ fun LazyListScope.aboutOthers( item { AboutContentColumn( leadingIcon = Outlined.PrivacyTip, - label = PrivacyPolicy.asString(), + label = stringResource(AboutRes.string.privacy_policy), testTag = AboutOthersPrivacyPolicyItemTestTag, onClickAction = onPrivacyPolicyItemClick, modifier = modifier diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/strings/AboutStrings.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/strings/AboutStrings.kt deleted file mode 100644 index 99c29541c..000000000 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/strings/AboutStrings.kt +++ /dev/null @@ -1,71 +0,0 @@ -package io.github.droidkaigi.confsched.about.strings - -import io.github.droidkaigi.confsched.designsystem.strings.Lang -import io.github.droidkaigi.confsched.designsystem.strings.Strings -import io.github.droidkaigi.confsched.designsystem.strings.StringsBindings - -// TODO: Please migrate this to Compose Multiplatform resources instead of this -sealed class AboutStrings : Strings(Bindings) { - data object Description : AboutStrings() - data object DateTitle : AboutStrings() - data object DateDescription : AboutStrings() - data object PlaceTitle : AboutStrings() - data object PlaceDescription : AboutStrings() - class PlaceLink( - val url: String = "https://goo.gl/maps/vv9sE19JvRjYKtSP9", - ) : AboutStrings() - data object CreditsTitle : AboutStrings() - data object Staff : AboutStrings() - data object Contributor : AboutStrings() - data object Sponsor : AboutStrings() - data object OthersTitle : AboutStrings() - data object CodeOfConduct : AboutStrings() - data object License : AboutStrings() - data object PrivacyPolicy : AboutStrings() - data object AppVersion : AboutStrings() - data object LicenceDescription : AboutStrings() - - private object Bindings : StringsBindings( - Lang.Japanese to { item, _ -> - when (item) { - Description -> "DroidKaigiはAndroid技術情報の共有とコミュニケーションを目的に開催されるエンジニアが主役のAndroidカンファレンスです。" - DateTitle -> "日時" - DateDescription -> "2024.09.11(水) 〜 13(金)" - PlaceTitle -> "場所" - PlaceDescription -> "ベルサール渋谷ガーデン" - is PlaceLink -> "地図を見る" - CreditsTitle -> "Credits" - Staff -> "スタッフ" - Contributor -> "コントリビューター" - Sponsor -> "スポンサー" - OthersTitle -> "Others" - CodeOfConduct -> "行動規範" - License -> "ライセンス" - PrivacyPolicy -> "プライバシーポリシー" - AppVersion -> "アプリバージョン" - LicenceDescription -> "The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License." - } - }, - Lang.English to { item, bindings -> - when (item) { - Description -> "DroidKaigi is a conference tailored for Android developers." - DateTitle -> "Date" - DateDescription -> "2024.09.11(Wed) - 13(Fri)" - PlaceTitle -> "Place" - PlaceDescription -> "Bellesalle Shibuya Garden" - is PlaceLink -> "View Map" - CreditsTitle -> bindings.defaultBinding(item, bindings) - Staff -> "Staff" - Contributor -> "Contributor" - Sponsor -> "Sponsor" - OthersTitle -> bindings.defaultBinding(item, bindings) - CodeOfConduct -> "Code Of Conduct" - License -> "License" - PrivacyPolicy -> "Privacy Policy" - AppVersion -> "App Version" - LicenceDescription -> bindings.defaultBinding(item, bindings) - } - }, - default = Lang.Japanese, - ) -} diff --git a/feature/sessions/src/commonMain/composeResources/values-ja/sessions_strings.xml b/feature/sessions/src/commonMain/composeResources/values-ja/sessions_strings.xml new file mode 100644 index 000000000..156886204 --- /dev/null +++ b/feature/sessions/src/commonMain/composeResources/values-ja/sessions_strings.xml @@ -0,0 +1,29 @@ + + スケジュール + ユーザー + エラー + ブックマークに追加されました + 一覧を見る + + ブックマーク済み + ブックマークされていません + 画像 + 特別 + 続きを読む + 対象者 + アーカイブ + スライド + 動画 + ワークショップ + 戻る + 言語選択 + 日本語 + English + タイムテーブル + 共有 + カレンダー + スケジュール + 場所 + 言語 + カテゴリ + diff --git a/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml b/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml deleted file mode 100644 index 5f4e5ce69..000000000 --- a/feature/sessions/src/commonMain/composeResources/values-ja/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - スケジュール - ユーザー - エラー - diff --git a/feature/sessions/src/commonMain/composeResources/values/sessions_strings.xml b/feature/sessions/src/commonMain/composeResources/values/sessions_strings.xml new file mode 100644 index 000000000..0cc8ae0f5 --- /dev/null +++ b/feature/sessions/src/commonMain/composeResources/values/sessions_strings.xml @@ -0,0 +1,29 @@ + + Schedule + User + Error + Bookmarked successfully. + View + Empty + Bookmarked + Not Bookmarked + image + Special + Read more + Target Audience + Archive + Slide + Video + Workshop + Back + Select Language + 日本語 + English + Timetable + Share + Calendar + Schedule + Location + Language + Category + diff --git a/feature/sessions/src/commonMain/composeResources/values/strings.xml b/feature/sessions/src/commonMain/composeResources/values/strings.xml deleted file mode 100644 index 36987535b..000000000 --- a/feature/sessions/src/commonMain/composeResources/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - Schedule - User - Error - diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt index c2778857a..dcc69d7b2 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt @@ -7,6 +7,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue +import conference_app_2024.feature.sessions.generated.resources.bookmarked_successfully +import conference_app_2024.feature.sessions.generated.resources.view_bookmark_list import io.github.droidkaigi.confsched.compose.SafeLaunchedEffect import io.github.droidkaigi.confsched.model.Lang import io.github.droidkaigi.confsched.model.SessionsRepository @@ -19,11 +21,10 @@ import io.github.droidkaigi.confsched.sessions.TimetableItemDetailEvent.SelectDe import io.github.droidkaigi.confsched.sessions.TimetableItemDetailEvent.ViewBookmarkListRequestCompleted import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading -import io.github.droidkaigi.confsched.sessions.strings.TimetableItemDetailStrings.BookmarkedSuccessfully -import io.github.droidkaigi.confsched.sessions.strings.TimetableItemDetailStrings.ViewBookmarkList import io.github.droidkaigi.confsched.ui.providePresenterDefaults import io.github.droidkaigi.confsched.ui.rememberNavigationArgument import kotlinx.coroutines.flow.SharedFlow +import org.jetbrains.compose.resources.stringResource sealed interface TimetableItemDetailEvent { data class Bookmark(val timetableItem: TimetableItem) : TimetableItemDetailEvent @@ -45,6 +46,8 @@ fun timetableItemDetailPresenter( .timetableItemWithBookmark(TimetableItemId(timetableItemId)), ) var selectedDescriptionLanguage by remember { mutableStateOf(null) } + val bookmarkedSuccessfullyString = stringResource(SessionsRes.string.bookmarked_successfully) + val viewBookmarkListString = stringResource(SessionsRes.string.view_bookmark_list) SafeLaunchedEffect(Unit) { events.collect { event -> @@ -57,8 +60,8 @@ fun timetableItemDetailPresenter( val oldBookmarked = timetableItemWithBookmark.second if (!oldBookmarked) { userMessageStateHolder.showMessage( - message = BookmarkedSuccessfully.asString(), - actionLabel = ViewBookmarkList.asString(), + message = bookmarkedSuccessfullyString, + actionLabel = viewBookmarkListString, duration = Short, ) } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt index b035d3c85..efa1eaa9d 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt @@ -37,6 +37,7 @@ import androidx.navigation.NavController import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable +import conference_app_2024.feature.sessions.generated.resources.timetable import io.github.droidkaigi.confsched.compose.EventEmitter import io.github.droidkaigi.confsched.compose.rememberEventEmitter import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme @@ -53,6 +54,7 @@ import io.github.droidkaigi.confsched.ui.UserMessageStateHolderImpl import io.github.droidkaigi.confsched.ui.compositionlocal.FakeClock import io.github.droidkaigi.confsched.ui.compositionlocal.LocalClock import kotlinx.collections.immutable.toPersistentMap +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview const val timetableScreenRoute = "timetable" @@ -146,7 +148,7 @@ private fun TimetableScreen( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = "タイムテーブル", + text = stringResource(SessionsRes.string.timetable), fontSize = 24.sp, lineHeight = 32.sp, fontWeight = FontWeight.W400, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt index 12f389c34..a67ba2fda 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailContent.kt @@ -26,6 +26,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import conference_app_2024.feature.sessions.generated.resources.archive +import conference_app_2024.feature.sessions.generated.resources.read_more +import conference_app_2024.feature.sessions.generated.resources.slide +import conference_app_2024.feature.sessions.generated.resources.special +import conference_app_2024.feature.sessions.generated.resources.target_audience +import conference_app_2024.feature.sessions.generated.resources.video import io.github.droidkaigi.confsched.designsystem.component.ClickableLinkText import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.designsystem.theme.LocalRoomTheme @@ -36,6 +42,8 @@ import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.TimetableItem.Session import io.github.droidkaigi.confsched.model.TimetableItem.Special import io.github.droidkaigi.confsched.model.fake +import io.github.droidkaigi.confsched.sessions.SessionsRes +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -71,7 +79,7 @@ fun TimetableItemDetailContent( } is Special -> { - Text("Special") + Text(stringResource(SessionsRes.string.special)) } } } @@ -100,7 +108,7 @@ private fun DescriptionSection( onClick = { isExpand = true }, ) { Text( - text = "続きを読む", + text = stringResource(SessionsRes.string.read_more), style = MaterialTheme.typography.labelLarge, color = LocalRoomTheme.current.primaryColor, ) @@ -117,7 +125,7 @@ private fun TargetAudienceSection( ) { Column(modifier = modifier.padding(8.dp)) { Text( - text = "対象者", + text = stringResource(SessionsRes.string.target_audience), style = MaterialTheme.typography.titleLarge, color = LocalRoomTheme.current.primaryColor, ) @@ -139,7 +147,7 @@ private fun ArchiveSection( ) { Column(modifier = modifier.padding(8.dp)) { Text( - text = "アーカイブ", + text = stringResource(SessionsRes.string.archive), style = MaterialTheme.typography.titleLarge, color = LocalRoomTheme.current.primaryColor, ) @@ -157,7 +165,7 @@ private fun ArchiveSection( ) { Icon( imageVector = Icons.Outlined.Description, - contentDescription = "Slide", + contentDescription = stringResource(SessionsRes.string.slide), ) Text( text = "スライド", @@ -176,7 +184,7 @@ private fun ArchiveSection( ) { Icon( imageVector = Icons.Outlined.PlayCircle, - contentDescription = "Video", + contentDescription = stringResource(SessionsRes.string.video), ) Text( text = "動画", diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt index c18bfe917..eb0c9ec77 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimeTableItemDetailSummaryCard.kt @@ -25,6 +25,10 @@ import androidx.compose.ui.graphics.PathEffect import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp +import conference_app_2024.feature.sessions.generated.resources.content_description_category +import conference_app_2024.feature.sessions.generated.resources.content_description_language +import conference_app_2024.feature.sessions.generated.resources.content_description_location +import conference_app_2024.feature.sessions.generated.resources.content_description_schedule import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.designsystem.theme.LocalRoomTheme import io.github.droidkaigi.confsched.model.Locale @@ -32,6 +36,8 @@ import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.model.getDefaultLocale import io.github.droidkaigi.confsched.model.nameAndFloor +import io.github.droidkaigi.confsched.sessions.SessionsRes +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -63,7 +69,7 @@ fun TimetableItemDetailSummaryCard( SummaryCardRow( modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Schedule, - contentDescription = "Schedule", + contentDescription = stringResource(SessionsRes.string.content_description_schedule), title = "日時", description = timetableItem.formattedDateTimeString, ) @@ -71,7 +77,7 @@ fun TimetableItemDetailSummaryCard( SummaryCardRow( modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.LocationOn, - contentDescription = "Location", + contentDescription = stringResource(SessionsRes.string.content_description_location), title = "場所", description = timetableItem.room.nameAndFloor, ) @@ -79,7 +85,7 @@ fun TimetableItemDetailSummaryCard( SummaryCardRow( modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Language, - contentDescription = "Language", + contentDescription = stringResource(SessionsRes.string.content_description_language), title = "対応言語", description = timetableItem.getSupportedLangString( getDefaultLocale() == Locale.JAPAN, @@ -89,7 +95,7 @@ fun TimetableItemDetailSummaryCard( SummaryCardRow( modifier = Modifier.fillMaxWidth(), imageVector = Icons.Outlined.Category, - contentDescription = "Category", + contentDescription = stringResource(SessionsRes.string.content_description_category), title = "カテゴリ", description = timetableItem.category.title.currentLangTitle, ) diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt index 3e1315e8b..7f489bb66 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailBottomAppBar.kt @@ -14,12 +14,15 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import conference_app_2024.feature.sessions.generated.resources.calendar_add_on +import conference_app_2024.feature.sessions.generated.resources.content_description_calendar +import conference_app_2024.feature.sessions.generated.resources.content_description_share import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.TimetableItem import io.github.droidkaigi.confsched.model.fake import io.github.droidkaigi.confsched.sessions.SessionsRes import io.github.droidkaigi.confsched.sessions.TimetableItemDetailBookmarkIconTestTag import org.jetbrains.compose.resources.painterResource +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @Composable @@ -37,13 +40,13 @@ fun TimetableItemDetailBottomAppBar( IconButton(onClick = { onShareClick(timetableItem) }) { Icon( imageVector = Icons.Outlined.Share, - contentDescription = "Share", + contentDescription = stringResource(SessionsRes.string.content_description_share), ) } IconButton(onClick = { onCalendarRegistrationClick(timetableItem) }) { Icon( painter = painterResource(SessionsRes.drawable.calendar_add_on), - contentDescription = "Calendar", + contentDescription = stringResource(SessionsRes.string.content_description_calendar), ) } }, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt index 004938cae..ca3b66bf5 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableItemDetailTopAppBar.kt @@ -20,9 +20,13 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import conference_app_2024.feature.sessions.generated.resources.english +import conference_app_2024.feature.sessions.generated.resources.japanese import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.designsystem.theme.LocalRoomTheme import io.github.droidkaigi.confsched.model.Lang +import io.github.droidkaigi.confsched.sessions.SessionsRes +import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview @OptIn(ExperimentalMaterial3Api::class) @@ -67,7 +71,7 @@ fun TimetableItemDetailTopAppBar( DropdownMenuItem( text = { Text( - text = "日本語", + text = stringResource(SessionsRes.string.japanese), style = MaterialTheme.typography.bodySmall, ) }, @@ -79,7 +83,7 @@ fun TimetableItemDetailTopAppBar( DropdownMenuItem( text = { Text( - text = "English", + text = stringResource(SessionsRes.string.english), style = MaterialTheme.typography.bodySmall, ) }, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt index f25f93c52..a2d3fcd6e 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt @@ -37,6 +37,9 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import conference_app_2024.feature.sessions.generated.resources.bookmarked +import conference_app_2024.feature.sessions.generated.resources.image +import conference_app_2024.feature.sessions.generated.resources.not_bookmarked import io.github.droidkaigi.confsched.designsystem.theme.LocalRoomTheme import io.github.droidkaigi.confsched.designsystem.theme.ProvideRoomTheme import io.github.droidkaigi.confsched.model.Timetable @@ -45,10 +48,12 @@ import io.github.droidkaigi.confsched.model.TimetableRoom.Shapes.CIRCLE import io.github.droidkaigi.confsched.model.TimetableRoom.Shapes.DIAMOND import io.github.droidkaigi.confsched.model.TimetableRoom.Shapes.SHARP_DIAMOND import io.github.droidkaigi.confsched.model.TimetableRoom.Shapes.SQUARE +import io.github.droidkaigi.confsched.sessions.SessionsRes import io.github.droidkaigi.confsched.sessions.TimetableListItemBookmarkIconTestTag import io.github.droidkaigi.confsched.sessions.TimetableListItemTestTag import io.github.droidkaigi.confsched.ui.rememberAsyncImagePainter import kotlinx.collections.immutable.PersistentMap +import org.jetbrains.compose.resources.stringResource const val TimetableListTestTag = "TimetableList" @@ -122,13 +127,13 @@ fun TimetableList( if (isBookmarked) { Icon( Icons.Filled.Favorite, - contentDescription = "Bookmarked", + contentDescription = stringResource(SessionsRes.string.bookmarked), tint = Color.Green, ) } else { Icon( Icons.Outlined.FavoriteBorder, - contentDescription = "Not Bookmarked", + contentDescription = stringResource(SessionsRes.string.not_bookmarked), tint = Color.White, ) } @@ -152,7 +157,7 @@ fun TimetableList( .width(32.dp) .height(32.dp) .clip(CircleShape), - contentDescription = "image", + contentDescription = stringResource(SessionsRes.string.image), ) Text( text = speaker.name, diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt index d1359af6b..12af1cb1d 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt @@ -20,14 +20,17 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalLayoutDirection +import conference_app_2024.feature.sessions.generated.resources.empty import io.github.droidkaigi.confsched.model.DroidKaigi2024Day import io.github.droidkaigi.confsched.model.DroidKaigi2024Day.ConferenceDay1 import io.github.droidkaigi.confsched.model.DroidKaigi2024Day.Workday import io.github.droidkaigi.confsched.model.TimetableItem +import io.github.droidkaigi.confsched.sessions.SessionsRes import io.github.droidkaigi.confsched.sessions.section.TimetableSheetUiState.Empty import io.github.droidkaigi.confsched.sessions.section.TimetableSheetUiState.GridTimetable import io.github.droidkaigi.confsched.sessions.section.TimetableSheetUiState.ListTimetable import io.github.droidkaigi.confsched.ui.compositionlocal.LocalClock +import org.jetbrains.compose.resources.stringResource const val TimetableTabTestTag = "TimetableTab" @@ -120,7 +123,7 @@ fun TimetableSheet( } Empty -> { - Text("Empty") + Text(stringResource(SessionsRes.string.empty)) } } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/strings/TimetableItemDetailStrings.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/strings/TimetableItemDetailStrings.kt deleted file mode 100644 index 450912ba8..000000000 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/strings/TimetableItemDetailStrings.kt +++ /dev/null @@ -1,26 +0,0 @@ -package io.github.droidkaigi.confsched.sessions.strings - -import io.github.droidkaigi.confsched.designsystem.strings.Lang -import io.github.droidkaigi.confsched.designsystem.strings.Strings -import io.github.droidkaigi.confsched.designsystem.strings.StringsBindings - -sealed class TimetableItemDetailStrings : Strings(Bindings) { - data object BookmarkedSuccessfully : TimetableItemDetailStrings() - data object ViewBookmarkList : TimetableItemDetailStrings() - - private object Bindings : StringsBindings( - Lang.Japanese to { item, _ -> - when (item) { - BookmarkedSuccessfully -> "ブックマークに追加されました" - ViewBookmarkList -> "一覧を見る" - } - }, - Lang.English to { item, _ -> - when (item) { - BookmarkedSuccessfully -> "Bookmarked successfully." - ViewBookmarkList -> "View" - } - }, - default = Lang.English, - ) -}