mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-26 03:50:40 +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:
@@ -14,7 +14,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.CountDownLatch
|
||||
@@ -49,7 +49,7 @@ class CloudflareInterceptor(
|
||||
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
|
||||
// we don't crash the entire app
|
||||
catch (e: CloudflareBypassException) {
|
||||
throw IOException(context.localize(MR.strings.information_cloudflare_bypass_failure), e)
|
||||
throw IOException(context.stringResource(MR.strings.information_cloudflare_bypass_failure), e)
|
||||
} catch (e: Exception) {
|
||||
throw IOException(e)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.util.system
|
||||
import android.content.Context
|
||||
import android.widget.Toast
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
|
||||
/**
|
||||
* Display a toast in this context.
|
||||
@@ -16,7 +16,7 @@ fun Context.toast(
|
||||
duration: Int = Toast.LENGTH_SHORT,
|
||||
block: (Toast) -> Unit = {},
|
||||
): Toast {
|
||||
return toast(localize(resource), duration, block)
|
||||
return toast(stringResource(resource), duration, block)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,18 +9,18 @@ import dev.icerock.moko.resources.desc.Resource
|
||||
import dev.icerock.moko.resources.desc.ResourceFormatted
|
||||
import dev.icerock.moko.resources.desc.StringDesc
|
||||
|
||||
fun Context.localize(resource: StringResource): String {
|
||||
fun Context.stringResource(resource: StringResource): String {
|
||||
return StringDesc.Resource(resource).toString(this)
|
||||
}
|
||||
|
||||
fun Context.localize(resource: StringResource, vararg args: Any): String {
|
||||
fun Context.stringResource(resource: StringResource, vararg args: Any): String {
|
||||
return StringDesc.ResourceFormatted(resource, *args).toString(this)
|
||||
}
|
||||
|
||||
fun Context.localizePlural(resource: PluralsResource, count: Int): String {
|
||||
fun Context.pluralStringResource(resource: PluralsResource, count: Int): String {
|
||||
return StringDesc.Plural(resource, count).toString(this)
|
||||
}
|
||||
|
||||
fun Context.localizePlural(resource: PluralsResource, count: Int, vararg args: Any): String {
|
||||
fun Context.pluralStringResource(resource: PluralsResource, count: Int, vararg args: Any): String {
|
||||
return StringDesc.PluralFormatted(resource, count, *args).toString(this)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package tachiyomi.core.provider
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import androidx.core.net.toUri
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.io.File
|
||||
|
||||
@@ -14,7 +14,7 @@ class AndroidBackupFolderProvider(
|
||||
override fun directory(): File {
|
||||
return File(
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||
context.localize(MR.strings.app_name),
|
||||
context.stringResource(MR.strings.app_name),
|
||||
"backup",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package tachiyomi.core.provider
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import androidx.core.net.toUri
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import java.io.File
|
||||
|
||||
@@ -14,7 +14,7 @@ class AndroidDownloadFolderProvider(
|
||||
override fun directory(): File {
|
||||
return File(
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||
context.localize(MR.strings.app_name),
|
||||
context.stringResource(MR.strings.app_name),
|
||||
"downloads",
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user