Make locale non-nullable

This commit is contained in:
2024-06-04 10:02:38 +03:00
parent 3ff9e69585
commit 0b2bf607f7
2 changed files with 6 additions and 4 deletions

View File

@@ -83,11 +83,11 @@ class ParserProcessor(
enum class MangaSource(
val title: String,
val locale: String?,
val locale: String,
val contentType: ContentType,
val isBroken: Boolean,
) {
LOCAL("Local", null, ContentType.OTHER, false),
LOCAL("Local", "", ContentType.OTHER, false),
""".trimIndent(),
)
@@ -110,7 +110,7 @@ class ParserProcessor(
)
sourcesWriter?.write(
"""
DUMMY("Dummy", null, ContentType.OTHER, false),
DUMMY("Dummy", "", ContentType.OTHER, false),
;
}
""".trimIndent(),
@@ -135,7 +135,7 @@ class ParserProcessor(
val title = annotation.arguments.single { it.name?.asString() == "title" }.value as String
val locale = annotation.arguments.single { it.name?.asString() == "locale" }.value as String
val type = annotation.arguments.single { it.name?.asString() == "type" }.value
val localeString = if (locale.isEmpty()) "null" else "\"$locale\""
val localeString = "\"$locale\""
val localeObj = if (locale.isEmpty()) null else Locale(locale)
val localeTitle = localeObj?.getDisplayLanguage(localeObj)
if (localeObj != null && localeObj !in availableLocales) {