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:
@@ -37,7 +37,7 @@ import logcat.LogPriority
|
||||
import okio.buffer
|
||||
import okio.gzip
|
||||
import okio.sink
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.preference.Preference
|
||||
import tachiyomi.core.preference.PreferenceStore
|
||||
import tachiyomi.core.util.system.logcat
|
||||
@@ -76,7 +76,7 @@ class BackupCreator(
|
||||
*/
|
||||
suspend fun createBackup(uri: Uri, flags: Int, isAutoBackup: Boolean): String {
|
||||
if (!context.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
throw IllegalStateException(context.localize(MR.strings.missing_storage_permission))
|
||||
throw IllegalStateException(context.stringResource(MR.strings.missing_storage_permission))
|
||||
}
|
||||
|
||||
val databaseManga = getFavorites.await()
|
||||
@@ -111,7 +111,7 @@ class BackupCreator(
|
||||
UniFile.fromUri(context, uri)
|
||||
}
|
||||
)
|
||||
?: throw Exception(context.localize(MR.strings.create_backup_file_error))
|
||||
?: throw Exception(context.stringResource(MR.strings.create_backup_file_error))
|
||||
|
||||
if (!file.isFile) {
|
||||
throw IllegalStateException("Failed to get handle on a backup file")
|
||||
@@ -119,7 +119,7 @@ class BackupCreator(
|
||||
|
||||
val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
|
||||
if (byteArray.isEmpty()) {
|
||||
throw IllegalStateException(context.localize(MR.strings.empty_backup_error))
|
||||
throw IllegalStateException(context.stringResource(MR.strings.empty_backup_error))
|
||||
}
|
||||
|
||||
file.openOutputStream().also {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.content.Context
|
||||
import android.net.Uri
|
||||
import eu.kanade.tachiyomi.data.track.TrackerManager
|
||||
import eu.kanade.tachiyomi.util.BackupUtil
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import tachiyomi.i18n.MR
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@@ -29,7 +29,7 @@ class BackupFileValidator(
|
||||
}
|
||||
|
||||
if (backup.backupManga.isEmpty()) {
|
||||
throw IllegalStateException(context.localize(MR.strings.invalid_backup_file_missing_manga))
|
||||
throw IllegalStateException(context.stringResource(MR.strings.invalid_backup_file_missing_manga))
|
||||
}
|
||||
|
||||
val sources = backup.backupSources.associate { it.sourceId to it.name }
|
||||
|
||||
@@ -12,8 +12,8 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||
import eu.kanade.tachiyomi.util.system.cancelNotification
|
||||
import eu.kanade.tachiyomi.util.system.notificationBuilder
|
||||
import eu.kanade.tachiyomi.util.system.notify
|
||||
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 uy.kohesive.injekt.injectLazy
|
||||
import java.io.File
|
||||
@@ -47,7 +47,7 @@ class BackupNotifier(private val context: Context) {
|
||||
|
||||
fun showBackupProgress(): NotificationCompat.Builder {
|
||||
val builder = with(progressNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.creating_backup))
|
||||
setContentTitle(context.stringResource(MR.strings.creating_backup))
|
||||
|
||||
setProgress(0, 0, true)
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class BackupNotifier(private val context: Context) {
|
||||
context.cancelNotification(Notifications.ID_BACKUP_PROGRESS)
|
||||
|
||||
with(completeNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.creating_backup_error))
|
||||
setContentTitle(context.stringResource(MR.strings.creating_backup_error))
|
||||
setContentText(error)
|
||||
|
||||
show(Notifications.ID_BACKUP_COMPLETE)
|
||||
@@ -72,13 +72,13 @@ class BackupNotifier(private val context: Context) {
|
||||
context.cancelNotification(Notifications.ID_BACKUP_PROGRESS)
|
||||
|
||||
with(completeNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.backup_created))
|
||||
setContentTitle(context.stringResource(MR.strings.backup_created))
|
||||
setContentText(unifile.filePath ?: unifile.name)
|
||||
|
||||
clearActions()
|
||||
addAction(
|
||||
R.drawable.ic_share_24dp,
|
||||
context.localize(MR.strings.action_share),
|
||||
context.stringResource(MR.strings.action_share),
|
||||
NotificationReceiver.shareBackupPendingBroadcast(
|
||||
context,
|
||||
unifile.uri,
|
||||
@@ -92,7 +92,7 @@ class BackupNotifier(private val context: Context) {
|
||||
|
||||
fun showRestoreProgress(
|
||||
content: String = "",
|
||||
contentTitle: String = context.localize(
|
||||
contentTitle: String = context.stringResource(
|
||||
MR.strings.restoring_backup,
|
||||
),
|
||||
progress: Int = 0,
|
||||
@@ -111,7 +111,7 @@ class BackupNotifier(private val context: Context) {
|
||||
clearActions()
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.localize(MR.strings.action_cancel),
|
||||
context.stringResource(MR.strings.action_cancel),
|
||||
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
|
||||
)
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class BackupNotifier(private val context: Context) {
|
||||
context.cancelNotification(Notifications.ID_RESTORE_PROGRESS)
|
||||
|
||||
with(completeNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.restoring_backup_error))
|
||||
setContentTitle(context.stringResource(MR.strings.restoring_backup_error))
|
||||
setContentText(error)
|
||||
|
||||
show(Notifications.ID_RESTORE_COMPLETE)
|
||||
@@ -137,13 +137,13 @@ class BackupNotifier(private val context: Context) {
|
||||
errorCount: Int,
|
||||
path: String?,
|
||||
file: String?,
|
||||
contentTitle: String = context.localize(
|
||||
contentTitle: String = context.stringResource(
|
||||
MR.strings.restore_completed,
|
||||
),
|
||||
) {
|
||||
context.cancelNotification(Notifications.ID_RESTORE_PROGRESS)
|
||||
|
||||
val timeString = context.localize(
|
||||
val timeString = context.stringResource(
|
||||
MR.strings.restore_duration,
|
||||
TimeUnit.MILLISECONDS.toMinutes(time),
|
||||
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
|
||||
@@ -154,7 +154,7 @@ class BackupNotifier(private val context: Context) {
|
||||
with(completeNotificationBuilder) {
|
||||
setContentTitle(contentTitle)
|
||||
setContentText(
|
||||
context.localizePlural(
|
||||
context.pluralStringResource(
|
||||
MR.plurals.restore_completed_message,
|
||||
errorCount,
|
||||
timeString,
|
||||
@@ -171,7 +171,7 @@ class BackupNotifier(private val context: Context) {
|
||||
setContentIntent(errorLogIntent)
|
||||
addAction(
|
||||
R.drawable.ic_folder_24dp,
|
||||
context.localize(MR.strings.action_show_errors),
|
||||
context.stringResource(MR.strings.action_show_errors),
|
||||
errorLogIntent,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.system.isRunning
|
||||
import eu.kanade.tachiyomi.util.system.workManager
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.i18n.MR
|
||||
|
||||
@@ -41,7 +41,7 @@ class BackupRestoreJob(private val context: Context, workerParams: WorkerParamet
|
||||
Result.success()
|
||||
} catch (e: Exception) {
|
||||
if (e is CancellationException) {
|
||||
notifier.showRestoreError(context.localize(MR.strings.restoring_backup_canceled))
|
||||
notifier.showRestoreError(context.stringResource(MR.strings.restoring_backup_canceled))
|
||||
Result.success()
|
||||
} else {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
|
||||
@@ -22,7 +22,7 @@ import eu.kanade.tachiyomi.util.BackupUtil
|
||||
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.isActive
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.preference.AndroidPreferenceStore
|
||||
import tachiyomi.core.preference.PreferenceStore
|
||||
import tachiyomi.data.DatabaseHandler
|
||||
@@ -94,7 +94,7 @@ class BackupRestorer(
|
||||
errors.size,
|
||||
logFile.parent,
|
||||
logFile.name,
|
||||
contentTitle = context.localize(MR.strings.library_sync_complete),
|
||||
contentTitle = context.stringResource(MR.strings.library_sync_complete),
|
||||
)
|
||||
} else {
|
||||
notifier.showRestoreComplete(time, errors.size, logFile.parent, logFile.name)
|
||||
@@ -193,8 +193,8 @@ class BackupRestorer(
|
||||
showRestoreProgress(
|
||||
restoreProgress,
|
||||
restoreAmount,
|
||||
context.localize(MR.strings.categories),
|
||||
context.localize(MR.strings.restoring_backup),
|
||||
context.stringResource(MR.strings.categories),
|
||||
context.stringResource(MR.strings.restoring_backup),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ class BackupRestorer(
|
||||
restoreProgress,
|
||||
restoreAmount,
|
||||
manga.title,
|
||||
context.localize(MR.strings.syncing_library),
|
||||
context.stringResource(MR.strings.syncing_library),
|
||||
)
|
||||
} else {
|
||||
showRestoreProgress(
|
||||
restoreProgress,
|
||||
restoreAmount,
|
||||
manga.title,
|
||||
context.localize(MR.strings.restoring_backup),
|
||||
context.stringResource(MR.strings.restoring_backup),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -634,8 +634,8 @@ class BackupRestorer(
|
||||
showRestoreProgress(
|
||||
restoreProgress,
|
||||
restoreAmount,
|
||||
context.localize(MR.strings.app_settings),
|
||||
context.localize(MR.strings.restoring_backup),
|
||||
context.stringResource(MR.strings.app_settings),
|
||||
context.stringResource(MR.strings.restoring_backup),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -649,8 +649,8 @@ class BackupRestorer(
|
||||
showRestoreProgress(
|
||||
restoreProgress,
|
||||
restoreAmount,
|
||||
context.localize(MR.strings.source_settings),
|
||||
context.localize(MR.strings.restoring_backup),
|
||||
context.stringResource(MR.strings.source_settings),
|
||||
context.stringResource(MR.strings.restoring_backup),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user