Migrate to multiplatform string resources (#10147)
* Migrate to multiplatform string resources * Move plurals translations into separate files * Fix lint check on generated files
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package eu.kanade.presentation.track
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.animation.animateContentSize
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
@@ -42,20 +41,21 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.domain.track.model.toDbTrack
|
||||
import eu.kanade.presentation.components.DropdownMenu
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.track.components.TrackLogoIcon
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.track.Tracker
|
||||
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.i18n.localize
|
||||
import java.text.DateFormat
|
||||
|
||||
private const val UnsetStatusTextAlpha = 0.5F
|
||||
@@ -131,7 +131,7 @@ fun TrackInfoDialogHome(
|
||||
private fun TrackInfoItem(
|
||||
title: String,
|
||||
tracker: Tracker,
|
||||
@StringRes status: Int?,
|
||||
status: StringResource?,
|
||||
onStatusClick: () -> Unit,
|
||||
chapters: String,
|
||||
onChaptersClick: () -> Unit,
|
||||
@@ -194,7 +194,7 @@ private fun TrackInfoItem(
|
||||
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
||||
TrackDetailsItem(
|
||||
modifier = Modifier.weight(1f),
|
||||
text = status?.let { stringResource(it) } ?: "",
|
||||
text = status?.let { localize(it) } ?: "",
|
||||
onClick = onStatusClick,
|
||||
)
|
||||
VerticalDivider()
|
||||
@@ -209,7 +209,7 @@ private fun TrackInfoItem(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.alpha(if (score == null) UnsetStatusTextAlpha else 1f),
|
||||
text = score ?: stringResource(R.string.score),
|
||||
text = score ?: localize(MR.strings.score),
|
||||
onClick = onScoreClick,
|
||||
)
|
||||
}
|
||||
@@ -221,14 +221,14 @@ private fun TrackInfoItem(
|
||||
TrackDetailsItem(
|
||||
modifier = Modifier.weight(1F),
|
||||
text = startDate,
|
||||
placeholder = stringResource(R.string.track_started_reading_date),
|
||||
placeholder = localize(MR.strings.track_started_reading_date),
|
||||
onClick = onStartDateClick,
|
||||
)
|
||||
VerticalDivider()
|
||||
TrackDetailsItem(
|
||||
modifier = Modifier.weight(1F),
|
||||
text = endDate,
|
||||
placeholder = stringResource(R.string.track_finished_reading_date),
|
||||
placeholder = localize(MR.strings.track_finished_reading_date),
|
||||
onClick = onEndDateClick,
|
||||
)
|
||||
}
|
||||
@@ -279,7 +279,7 @@ private fun TrackInfoItemEmpty(
|
||||
.padding(start = 16.dp)
|
||||
.weight(1f),
|
||||
) {
|
||||
Text(text = stringResource(R.string.add_tracking))
|
||||
Text(text = localize(MR.strings.add_tracking))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ private fun TrackInfoItemMenu(
|
||||
IconButton(onClick = { expanded = true }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.MoreVert,
|
||||
contentDescription = stringResource(R.string.label_more),
|
||||
contentDescription = localize(MR.strings.label_more),
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
@@ -302,14 +302,14 @@ private fun TrackInfoItemMenu(
|
||||
onDismissRequest = { expanded = false },
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.action_open_in_browser)) },
|
||||
text = { Text(localize(MR.strings.action_open_in_browser)) },
|
||||
onClick = {
|
||||
onOpenInBrowser()
|
||||
expanded = false
|
||||
},
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text(stringResource(R.string.action_remove)) },
|
||||
text = { Text(localize(MR.strings.action_remove)) },
|
||||
onClick = {
|
||||
onRemoved()
|
||||
expanded = false
|
||||
|
||||
Reference in New Issue
Block a user