mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Replace remaining Android-specific strings
Also renaming the helper composables so it's a bit easier to find/replace everything in forks.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package eu.kanade.tachiyomi.util.lang
|
||||
|
||||
import android.content.Context
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.localizePlural
|
||||
import tachiyomi.core.i18n.pluralStringResource
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.text.DateFormat
|
||||
import java.time.Instant
|
||||
@@ -63,8 +63,8 @@ fun Date.toRelativeString(
|
||||
val days = difference.floorDiv(MILLISECONDS_IN_DAY).toInt()
|
||||
return when {
|
||||
difference < 0 -> dateFormat.format(this)
|
||||
difference < MILLISECONDS_IN_DAY -> context.localize(MR.strings.relative_time_today)
|
||||
difference < MILLISECONDS_IN_DAY.times(7) -> context.localizePlural(
|
||||
difference < MILLISECONDS_IN_DAY -> context.stringResource(MR.strings.relative_time_today)
|
||||
difference < MILLISECONDS_IN_DAY.times(7) -> context.pluralStringResource(
|
||||
MR.plurals.relative_time,
|
||||
days,
|
||||
days,
|
||||
|
||||
@@ -11,7 +11,7 @@ import androidx.biometric.auth.startClass2BiometricOrCredentialAuthentication
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
@@ -49,7 +49,7 @@ object AuthenticatorUtil {
|
||||
|
||||
suspend fun FragmentActivity.authenticate(
|
||||
title: String,
|
||||
subtitle: String? = localize(MR.strings.confirm_lock_change),
|
||||
subtitle: String? = stringResource(MR.strings.confirm_lock_change),
|
||||
): Boolean = suspendCancellableCoroutine { cont ->
|
||||
if (!isAuthenticationSupported()) {
|
||||
cont.resume(true)
|
||||
|
||||
@@ -24,7 +24,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
||||
import logcat.LogPriority
|
||||
import rikka.sui.Sui
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.i18n.MR
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@@ -47,7 +47,7 @@ fun Context.copyToClipboard(label: String, content: String) {
|
||||
// Android 13 and higher shows a visual confirmation of copied contents
|
||||
// https://developer.android.com/about/versions/13/features/copy-paste
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||
toast(localize(MR.strings.copied_to_clipboard, content.truncateCenter(50)))
|
||||
toast(stringResource(MR.strings.copied_to_clipboard, content.truncateCenter(50)))
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import androidx.core.content.IntentCompat
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.io.Serializable
|
||||
|
||||
@@ -28,7 +28,7 @@ fun Uri.toShareIntent(context: Context, type: String = "image/*", message: Strin
|
||||
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
}
|
||||
|
||||
return Intent.createChooser(shareIntent, context.localize(MR.strings.action_share)).apply {
|
||||
return Intent.createChooser(shareIntent, context.stringResource(MR.strings.action_share)).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.util.system
|
||||
import android.content.Context
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import eu.kanade.tachiyomi.ui.browse.source.SourcesScreenModel
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.util.Locale
|
||||
|
||||
@@ -30,10 +30,10 @@ object LocaleHelper {
|
||||
*/
|
||||
fun getSourceDisplayName(lang: String?, context: Context): String {
|
||||
return when (lang) {
|
||||
SourcesScreenModel.LAST_USED_KEY -> context.localize(MR.strings.last_used_source)
|
||||
SourcesScreenModel.PINNED_KEY -> context.localize(MR.strings.pinned_sources)
|
||||
"other" -> context.localize(MR.strings.other_source)
|
||||
"all" -> context.localize(MR.strings.multi_lang)
|
||||
SourcesScreenModel.LAST_USED_KEY -> context.stringResource(MR.strings.last_used_source)
|
||||
SourcesScreenModel.PINNED_KEY -> context.stringResource(MR.strings.pinned_sources)
|
||||
"other" -> context.stringResource(MR.strings.other_source)
|
||||
"all" -> context.stringResource(MR.strings.multi_lang)
|
||||
else -> getDisplayName(lang)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user