Make some error messages localizable (#9811)
* Make error message of 3 exceptions localizable. * Revert unnecessary file handle exception change. (cherry picked from commit 8f395d98e7be976263d2ee9b7559c2638d57b47e)
This commit is contained in:
parent
d098abc7e1
commit
bef7a42da5
@ -3,6 +3,7 @@ package eu.kanade.presentation.util
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.network.HttpException
|
import eu.kanade.tachiyomi.network.HttpException
|
||||||
|
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
|
||||||
import tachiyomi.data.source.NoResultsException
|
import tachiyomi.data.source.NoResultsException
|
||||||
import tachiyomi.domain.source.model.SourceNotInstalledException
|
import tachiyomi.domain.source.model.SourceNotInstalledException
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ val Throwable.formattedMessage: String
|
|||||||
is NoResultsException -> return getString(R.string.no_results_found)
|
is NoResultsException -> return getString(R.string.no_results_found)
|
||||||
is SourceNotInstalledException -> return getString(R.string.loader_not_implemented_error)
|
is SourceNotInstalledException -> return getString(R.string.loader_not_implemented_error)
|
||||||
is HttpException -> return "$message: ${getString(R.string.http_error_hint)}"
|
is HttpException -> return "$message: ${getString(R.string.http_error_hint)}"
|
||||||
|
is LicensedMangaChaptersException -> return getString(R.string.licensed_manga_chapters_error)
|
||||||
}
|
}
|
||||||
return when (val className = this::class.simpleName) {
|
return when (val className = this::class.simpleName) {
|
||||||
"Exception", "IOException" -> message ?: className
|
"Exception", "IOException" -> message ?: className
|
||||||
|
@ -147,10 +147,10 @@ class BackupManager(
|
|||||||
UniFile.fromUri(context, uri)
|
UniFile.fromUri(context, uri)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
?: throw Exception("Couldn't create backup file")
|
?: throw Exception(context.getString(R.string.create_backup_file_error))
|
||||||
|
|
||||||
if (!file.isFile) {
|
if (!file.isFile) {
|
||||||
throw IllegalStateException("Failed to get handle on file")
|
throw IllegalStateException("Failed to get handle on a backup file")
|
||||||
}
|
}
|
||||||
|
|
||||||
val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
|
val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
|
||||||
|
@ -494,6 +494,7 @@
|
|||||||
<string name="creating_backup_error">Backup failed</string>
|
<string name="creating_backup_error">Backup failed</string>
|
||||||
<string name="missing_storage_permission">Storage permissions not granted</string>
|
<string name="missing_storage_permission">Storage permissions not granted</string>
|
||||||
<string name="empty_backup_error">No library entries to back up</string>
|
<string name="empty_backup_error">No library entries to back up</string>
|
||||||
|
<string name="create_backup_file_error">Couldn\'t create a backup file</string>
|
||||||
<string name="restore_miui_warning">Backup/restore may not function properly if MIUI Optimization is disabled.</string>
|
<string name="restore_miui_warning">Backup/restore may not function properly if MIUI Optimization is disabled.</string>
|
||||||
<string name="restore_in_progress">Restore is already in progress</string>
|
<string name="restore_in_progress">Restore is already in progress</string>
|
||||||
<string name="restoring_backup">Restoring backup</string>
|
<string name="restoring_backup">Restoring backup</string>
|
||||||
@ -607,6 +608,7 @@
|
|||||||
<string name="no_results_found">No results found</string>
|
<string name="no_results_found">No results found</string>
|
||||||
<!-- Do not translate "WebView" -->
|
<!-- Do not translate "WebView" -->
|
||||||
<string name="http_error_hint">Check website in WebView</string>
|
<string name="http_error_hint">Check website in WebView</string>
|
||||||
|
<string name="licensed_manga_chapters_error">Licensed - No chapters to show</string>
|
||||||
<string name="local_source">Local source</string>
|
<string name="local_source">Local source</string>
|
||||||
<string name="other_source">Other</string>
|
<string name="other_source">Other</string>
|
||||||
<string name="last_used_source">Last used</string>
|
<string name="last_used_source">Last used</string>
|
||||||
|
@ -267,7 +267,7 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
chapterListParse(response)
|
chapterListParse(response)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Observable.error(Exception("Licensed - No chapters to show"))
|
Observable.error(LicensedMangaChaptersException())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,3 +471,5 @@ abstract class HttpSource : CatalogueSource {
|
|||||||
}
|
}
|
||||||
// EXH <--
|
// EXH <--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LicensedMangaChaptersException : Exception("Licensed - No chapters to show")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user