Skip to content

Commit

Permalink
Migrate string resource from string class
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jul 28, 2024
1 parent 04261a2 commit 27ea36f
Show file tree
Hide file tree
Showing 23 changed files with 212 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="description">DroidKaigiはAndroid技術情報の共有とコミュニケーションを目的に開催されるエンジニアが主役のAndroidカンファレンスです。</string>
<string name="date_title">日時</string>
<string name="date_description">2024.09.11(水) 〜 13(金)</string>
<string name="place_title">場所</string>
<string name="place_description">ベルサール渋谷ガーデン</string>
<string name="place_link">地図を見る</string>
<string name="credits_title">Credits</string>
<string name="staff">スタッフ</string>
<string name="contributor">コントリビューター</string>
<string name="sponsor">スポンサー</string>
<string name="others_title">Others</string>
<string name="code_of_conduct">行動規範</string>
<string name="license">ライセンス</string>
<string name="privacy_policy">プライバシーポリシー</string>
<string name="app_version">アプリバージョン</string>
<string name="content_description_youtube">YouTube</string>
<string name="content_description_x">X</string>
<string name="content_description_medium">Medium</string>
<string name="license_description">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.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="description">DroidKaigi is a conference tailored for Android developers.</string>
<string name="date_title">Date</string>
<string name="date_description">2024.09.11(Wed) - 13(Fri)</string>
<string name="place_title">Place</string>
<string name="place_description">Bellesalle Shibuya Garden</string>
<string name="place_link">View Map</string>
<string name="credits_title">Credits</string>
<string name="staff">Staff</string>
<string name="contributor">Contributor</string>
<string name="sponsor">Sponsor</string>
<string name="others_title">Others</string>
<string name="code_of_conduct">Code Of Conduct</string>
<string name="license">License</string>
<string name="privacy_policy">Privacy Policy</string>
<string name="app_version">App Version</string>
<string name="content_description_youtube">YouTube</string>
<string name="content_description_x">X</string>
<string name="content_description_medium">Medium</string>
<string name="license_description">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.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,7 +83,7 @@ fun AboutContentColumnPreview() {
Surface {
AboutContentColumn(
leadingIcon = Outlined.SentimentVerySatisfied,
label = AboutStrings.Staff.asString(),
label = stringResource(AboutRes.string.staff),
testTag = "",
onClickAction = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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(
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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(
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<resources>
<string name="content_description_schedule_icon">スケジュール</string>
<string name="content_description_user_icon">ユーザー</string>
<string name="content_description_error_icon">エラー</string>
<string name="bookmarked_successfully">ブックマークに追加されました</string>
<string name="view_bookmark_list">一覧を見る</string>
<string name="empty">空</string>
<string name="bookmarked">ブックマーク済み</string>
<string name="not_bookmarked">ブックマークされていません</string>
<string name="image">画像</string>
<string name="special">特別</string>
<string name="read_more">続きを読む</string>
<string name="target_audience">対象者</string>
<string name="archive">アーカイブ</string>
<string name="slide">スライド</string>
<string name="video">動画</string>
<string name="workshop">ワークショップ</string>
<string name="back">戻る</string>
<string name="select_language">言語選択</string>
<string name="japanese">日本語</string>
<string name="english">English</string>
<string name="timetable">タイムテーブル</string>
<string name="content_description_share">共有</string>
<string name="content_description_calendar">カレンダー</string>
<string name="content_description_schedule">スケジュール</string>
<string name="content_description_location">場所</string>
<string name="content_description_language">言語</string>
<string name="content_description_category">カテゴリ</string>
</resources>

This file was deleted.

Loading

0 comments on commit 27ea36f

Please sign in to comment.