mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-18 22:09:14 +01:00
Make default category translatable (#5751)
* Make default category translatable * Replace duplicate strings with common one
This commit is contained in:
parent
90ab04e81d
commit
3670d649b8
@ -1,5 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.data.database.models
|
package eu.kanade.tachiyomi.data.database.models
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
|
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
|
||||||
import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting
|
import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting
|
||||||
import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
|
import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
|
||||||
@ -37,6 +39,6 @@ interface Category : Serializable {
|
|||||||
this.name = name
|
this.name = name
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createDefault(): Category = create("Default").apply { id = 0 }
|
fun createDefault(context: Context): Category = create(context.getString(R.string.label_default)).apply { id = 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ object PreferenceValues {
|
|||||||
/* ktlint-enable experimental:enum-entry-name-case */
|
/* ktlint-enable experimental:enum-entry-name-case */
|
||||||
|
|
||||||
enum class AppTheme(val titleResId: Int?) {
|
enum class AppTheme(val titleResId: Int?) {
|
||||||
DEFAULT(R.string.theme_default),
|
DEFAULT(R.string.label_default),
|
||||||
MONET(R.string.theme_monet),
|
MONET(R.string.theme_monet),
|
||||||
BLUE(R.string.theme_blue),
|
BLUE(R.string.theme_blue),
|
||||||
GREEN_APPLE(R.string.theme_greenapple),
|
GREEN_APPLE(R.string.theme_greenapple),
|
||||||
|
@ -327,7 +327,7 @@ class LibraryPresenter(
|
|||||||
private fun getLibraryObservable(): Observable<Library> {
|
private fun getLibraryObservable(): Observable<Library> {
|
||||||
return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga ->
|
return Observable.combineLatest(getCategoriesObservable(), getLibraryMangasObservable()) { dbCategories, libraryManga ->
|
||||||
val categories = if (libraryManga.containsKey(0)) {
|
val categories = if (libraryManga.containsKey(0)) {
|
||||||
arrayListOf(Category.createDefault()) + dbCategories
|
arrayListOf(Category.createDefault(context)) + dbCategories
|
||||||
} else {
|
} else {
|
||||||
dbCategories
|
dbCategories
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.R
|
|||||||
|
|
||||||
enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
|
enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
|
||||||
// TODO Default icon
|
// TODO Default icon
|
||||||
DEFAULT(0, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.default_rotation_type, R.drawable.ic_screen_rotation_24dp, 0x00000000),
|
DEFAULT(0, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.label_default, R.drawable.ic_screen_rotation_24dp, 0x00000000),
|
||||||
FREE(1, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.rotation_free, R.drawable.ic_screen_rotation_24dp, 0x00000008),
|
FREE(1, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED, R.string.rotation_free, R.drawable.ic_screen_rotation_24dp, 0x00000008),
|
||||||
PORTRAIT(2, ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT, R.string.rotation_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000010),
|
PORTRAIT(2, ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT, R.string.rotation_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000010),
|
||||||
LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
|
LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018),
|
||||||
|
@ -11,7 +11,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
|||||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
||||||
|
|
||||||
enum class ReadingModeType(val prefValue: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
|
enum class ReadingModeType(val prefValue: Int, @StringRes val stringRes: Int, @DrawableRes val iconRes: Int, val flagValue: Int) {
|
||||||
DEFAULT(0, R.string.default_viewer, R.drawable.ic_reader_default_24dp, 0x00000000),
|
DEFAULT(0, R.string.label_default, R.drawable.ic_reader_default_24dp, 0x00000000),
|
||||||
LEFT_TO_RIGHT(1, R.string.left_to_right_viewer, R.drawable.ic_reader_ltr_24dp, 0x00000001),
|
LEFT_TO_RIGHT(1, R.string.left_to_right_viewer, R.drawable.ic_reader_ltr_24dp, 0x00000001),
|
||||||
RIGHT_TO_LEFT(2, R.string.right_to_left_viewer, R.drawable.ic_reader_rtl_24dp, 0x00000002),
|
RIGHT_TO_LEFT(2, R.string.right_to_left_viewer, R.drawable.ic_reader_rtl_24dp, 0x00000002),
|
||||||
VERTICAL(3, R.string.vertical_viewer, R.drawable.ic_reader_vertical_24dp, 0x00000003),
|
VERTICAL(3, R.string.vertical_viewer, R.drawable.ic_reader_vertical_24dp, 0x00000003),
|
||||||
|
@ -96,7 +96,7 @@ class SettingsDownloadController : SettingsController() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.pref_category_auto_download
|
titleRes = R.string.pref_category_auto_download
|
||||||
@ -228,7 +228,7 @@ class SettingsDownloadController : SettingsController() {
|
|||||||
|
|
||||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
val categories = listOf(Category.createDefault(activity!!)) + dbCategories
|
||||||
|
|
||||||
val items = categories.map { it.name }
|
val items = categories.map { it.name }
|
||||||
var selected = categories
|
var selected = categories
|
||||||
|
@ -103,7 +103,7 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
entries = entryValues.map { value ->
|
entries = entryValues.map { value ->
|
||||||
val formattedDate = preferences.dateFormat(value.toString()).format(now)
|
val formattedDate = preferences.dateFormat(value.toString()).format(now)
|
||||||
if (value == "") {
|
if (value == "") {
|
||||||
"${context.getString(R.string.system_default)} ($formattedDate)"
|
"${context.getString(R.string.label_default)} ($formattedDate)"
|
||||||
} else {
|
} else {
|
||||||
"$value ($formattedDate)"
|
"$value ($formattedDate)"
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
titleRes = R.string.pref_category_library
|
titleRes = R.string.pref_category_library
|
||||||
|
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
val categories = listOf(Category.createDefault(context)) + dbCategories
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.pref_category_display
|
titleRes = R.string.pref_category_display
|
||||||
@ -65,7 +65,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
|
|
||||||
fun getColumnValue(value: Int): String {
|
fun getColumnValue(value: Int): String {
|
||||||
return if (value == 0) {
|
return if (value == 0) {
|
||||||
context.getString(R.string.default_columns)
|
context.getString(R.string.label_default)
|
||||||
} else {
|
} else {
|
||||||
value.toString()
|
value.toString()
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
|
|
||||||
fun onViewCreated(binding: PrefLibraryColumnsBinding) {
|
fun onViewCreated(binding: PrefLibraryColumnsBinding) {
|
||||||
with(binding.portraitColumns) {
|
with(binding.portraitColumns) {
|
||||||
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
displayedValues = arrayOf(context.getString(R.string.label_default)) +
|
||||||
IntRange(1, 10).map(Int::toString)
|
IntRange(1, 10).map(Int::toString)
|
||||||
value = portrait
|
value = portrait
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
with(binding.landscapeColumns) {
|
with(binding.landscapeColumns) {
|
||||||
displayedValues = arrayOf(context.getString(R.string.default_columns)) +
|
displayedValues = arrayOf(context.getString(R.string.label_default)) +
|
||||||
IntRange(1, 10).map(Int::toString)
|
IntRange(1, 10).map(Int::toString)
|
||||||
value = landscape
|
value = landscape
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
|
|
||||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||||
val dbCategories = db.getCategories().executeAsBlocking()
|
val dbCategories = db.getCategories().executeAsBlocking()
|
||||||
val categories = listOf(Category.createDefault()) + dbCategories
|
val categories = listOf(Category.createDefault(activity!!)) + dbCategories
|
||||||
|
|
||||||
val items = categories.map { it.name }
|
val items = categories.map { it.name }
|
||||||
var selected = categories
|
var selected = categories
|
||||||
|
@ -122,5 +122,3 @@ fun Date.toRelativeString(
|
|||||||
else -> dateFormat.format(this)
|
else -> dateFormat.format(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string-array name="color_filter_modes">
|
<string-array name="color_filter_modes">
|
||||||
<item>@string/filter_mode_default</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/filter_mode_multiply</item>
|
<item>@string/filter_mode_multiply</item>
|
||||||
<item>@string/filter_mode_screen</item>
|
<item>@string/filter_mode_screen</item>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string-array name="viewers_selector">
|
<string-array name="viewers_selector">
|
||||||
<item>@string/default_viewer</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/left_to_right_viewer</item>
|
<item>@string/left_to_right_viewer</item>
|
||||||
<item>@string/right_to_left_viewer</item>
|
<item>@string/right_to_left_viewer</item>
|
||||||
<item>@string/vertical_viewer</item>
|
<item>@string/vertical_viewer</item>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="rotation_type">
|
<string-array name="rotation_type">
|
||||||
<item>@string/default_rotation_type</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/rotation_free</item>
|
<item>@string/rotation_free</item>
|
||||||
<item>@string/rotation_portrait</item>
|
<item>@string/rotation_portrait</item>
|
||||||
<item>@string/rotation_landscape</item>
|
<item>@string/rotation_landscape</item>
|
||||||
@ -72,7 +72,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="color_filter_modes">
|
<string-array name="color_filter_modes">
|
||||||
<item>@string/filter_mode_default</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/filter_mode_multiply</item>
|
<item>@string/filter_mode_multiply</item>
|
||||||
<item>@string/filter_mode_screen</item>
|
<item>@string/filter_mode_screen</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="pager_nav">
|
<string-array name="pager_nav">
|
||||||
<item>@string/default_nav</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/l_nav</item>
|
<item>@string/l_nav</item>
|
||||||
<item>@string/kindlish_nav</item>
|
<item>@string/kindlish_nav</item>
|
||||||
<item>@string/edge_nav</item>
|
<item>@string/edge_nav</item>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="webtoon_nav">
|
<string-array name="webtoon_nav">
|
||||||
<item>@string/default_nav</item>
|
<item>@string/label_default</item>
|
||||||
<item>@string/l_nav</item>
|
<item>@string/l_nav</item>
|
||||||
<item>@string/kindlish_nav</item>
|
<item>@string/kindlish_nav</item>
|
||||||
<item>@string/edge_nav</item>
|
<item>@string/edge_nav</item>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<string name="label_extensions">Extensions</string>
|
<string name="label_extensions">Extensions</string>
|
||||||
<string name="label_extension_info">Extension info</string>
|
<string name="label_extension_info">Extension info</string>
|
||||||
<string name="label_help">Help</string>
|
<string name="label_help">Help</string>
|
||||||
|
<string name="label_default">Default</string>
|
||||||
|
|
||||||
<string name="unlock_app">Unlock Tachiyomi</string>
|
<string name="unlock_app">Unlock Tachiyomi</string>
|
||||||
<string name="confirm_lock_change">Authenticate to confirm change</string>
|
<string name="confirm_lock_change">Authenticate to confirm change</string>
|
||||||
@ -147,7 +148,6 @@
|
|||||||
<string name="theme_light">Off</string>
|
<string name="theme_light">Off</string>
|
||||||
<string name="theme_dark">On</string>
|
<string name="theme_dark">On</string>
|
||||||
<string name="pref_app_theme">App theme</string>
|
<string name="pref_app_theme">App theme</string>
|
||||||
<string name="theme_default">Default</string>
|
|
||||||
<string name="theme_monet">Dynamic</string>
|
<string name="theme_monet">Dynamic</string>
|
||||||
<string name="theme_blue">Blue</string>
|
<string name="theme_blue">Blue</string>
|
||||||
<string name="theme_greenapple">Green Apple</string>
|
<string name="theme_greenapple">Green Apple</string>
|
||||||
@ -159,7 +159,6 @@
|
|||||||
<string name="theme_yotsuba">Yotsuba</string>
|
<string name="theme_yotsuba">Yotsuba</string>
|
||||||
<string name="pref_dark_theme_pure_black">Pure black dark mode</string>
|
<string name="pref_dark_theme_pure_black">Pure black dark mode</string>
|
||||||
<string name="pref_start_screen">Start screen</string>
|
<string name="pref_start_screen">Start screen</string>
|
||||||
<string name="system_default">Default</string>
|
|
||||||
<string name="pref_date_format">Date format</string>
|
<string name="pref_date_format">Date format</string>
|
||||||
<string name="pref_confirm_exit">Confirm exit</string>
|
<string name="pref_confirm_exit">Confirm exit</string>
|
||||||
<string name="pref_hide_bottom_bar_on_scroll">Hide bottom bar on scroll</string>
|
<string name="pref_hide_bottom_bar_on_scroll">Hide bottom bar on scroll</string>
|
||||||
@ -203,7 +202,6 @@
|
|||||||
<string name="pref_library_columns">Items per row</string>
|
<string name="pref_library_columns">Items per row</string>
|
||||||
<string name="portrait">Portrait</string>
|
<string name="portrait">Portrait</string>
|
||||||
<string name="landscape">Landscape</string>
|
<string name="landscape">Landscape</string>
|
||||||
<string name="default_columns">Default</string>
|
|
||||||
<string name="pref_jump_to_chapters">Jump to chapters on open</string>
|
<string name="pref_jump_to_chapters">Jump to chapters on open</string>
|
||||||
|
|
||||||
<string name="pref_category_library_update">Global update</string>
|
<string name="pref_category_library_update">Global update</string>
|
||||||
@ -290,7 +288,6 @@
|
|||||||
<string name="pref_inverted_colors">Inverted</string>
|
<string name="pref_inverted_colors">Inverted</string>
|
||||||
<string name="pref_custom_color_filter">Custom color filter</string>
|
<string name="pref_custom_color_filter">Custom color filter</string>
|
||||||
<string name="pref_color_filter_mode">Color filter blend mode</string>
|
<string name="pref_color_filter_mode">Color filter blend mode</string>
|
||||||
<string name="filter_mode_default">Default</string>
|
|
||||||
<string name="filter_mode_overlay">Overlay</string>
|
<string name="filter_mode_overlay">Overlay</string>
|
||||||
<string name="filter_mode_multiply">Multiply</string>
|
<string name="filter_mode_multiply">Multiply</string>
|
||||||
<string name="filter_mode_screen">Screen</string>
|
<string name="filter_mode_screen">Screen</string>
|
||||||
@ -318,8 +315,6 @@
|
|||||||
<string name="black_background">Black</string>
|
<string name="black_background">Black</string>
|
||||||
<string name="automatic_background">Automatic</string>
|
<string name="automatic_background">Automatic</string>
|
||||||
<string name="pref_viewer_type">Default reading mode</string>
|
<string name="pref_viewer_type">Default reading mode</string>
|
||||||
<string name="default_viewer">Default</string>
|
|
||||||
<string name="default_nav">Default</string>
|
|
||||||
<string name="l_nav">L shaped</string>
|
<string name="l_nav">L shaped</string>
|
||||||
<string name="kindlish_nav">Kindle-ish</string>
|
<string name="kindlish_nav">Kindle-ish</string>
|
||||||
<string name="edge_nav">Edge</string>
|
<string name="edge_nav">Edge</string>
|
||||||
@ -351,7 +346,6 @@
|
|||||||
<string name="double_tap_anim_speed_normal">Normal</string>
|
<string name="double_tap_anim_speed_normal">Normal</string>
|
||||||
<string name="double_tap_anim_speed_fast">Fast</string>
|
<string name="double_tap_anim_speed_fast">Fast</string>
|
||||||
<string name="pref_rotation_type">Default rotation type</string>
|
<string name="pref_rotation_type">Default rotation type</string>
|
||||||
<string name="default_rotation_type">Default</string>
|
|
||||||
<string name="rotation_type">Rotation type</string>
|
<string name="rotation_type">Rotation type</string>
|
||||||
<string name="rotation_free">Free</string>
|
<string name="rotation_free">Free</string>
|
||||||
<string name="rotation_portrait">Portrait</string>
|
<string name="rotation_portrait">Portrait</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user