EH/ExH: better language detection in case actual language tag is not the first one (#782)

This commit is contained in:
Cuong-Tran 2025-03-24 23:46:12 +07:00 committed by GitHub
parent e6a09bacdc
commit 374eee18d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 40 additions and 38 deletions

View file

@ -127,11 +127,13 @@ fun BrowseSourceEHentaiListItem(
val context = LocalContext.current
val languageText by produceState("", metadata) {
value = withIOContext {
val locale = SourceTagsUtil.getLocaleSourceUtil(
metadata.tags
.firstOrNull { it.namespace == EHentaiSearchMetadata.EH_LANGUAGE_NAMESPACE }
?.name,
)
// KMK -->
val locale = metadata.tags
.filter { it.namespace == EHentaiSearchMetadata.EH_LANGUAGE_NAMESPACE }
.firstNotNullOfOrNull {
SourceTagsUtil.getLocaleSourceUtil(it.name)
}
// KMK <--
val pageCount = metadata.length
if (locale != null && pageCount != null) {
context.pluralStringResource(

View file

@ -21,8 +21,8 @@
<item quantity="other">%1$d পৃষ্ঠাসমূহ</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d পৃষ্ঠা</item>
<item quantity="other">%2$s, %1$d পৃষ্ঠাসমূহ</item>
<item quantity="one">%2$s %1$d পৃষ্ঠা</item>
<item quantity="other">%2$s %1$d পৃষ্ঠাসমূহ</item>
</plurals>
<plurals name="humanize_year">
<item quantity="one">%1$d বৰ্ষ পূৰ্বে</item>

View file

@ -38,8 +38,8 @@
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d page</item>
<item quantity="other">%2$s, %1$d pages</item>
<item quantity="one">%2$s %1$d page</item>
<item quantity="other">%2$s %1$d pages</item>
</plurals>
<!-- Humanize time -->

View file

@ -33,8 +33,8 @@
<item quantity="other">%1$d Seiten</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d Seite</item>
<item quantity="other">%2$s, %1$d Seiten</item>
<item quantity="one">%2$s %1$d Seite</item>
<item quantity="other">%2$s %1$d Seiten</item>
</plurals>
<plurals name="humanize_year">
<item quantity="one">vor %1$d Jahr</item>

View file

@ -33,8 +33,8 @@
<item quantity="other">antaŭ %1$d tagoj</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d paĝo</item>
<item quantity="other">%2$s, %1$d paĝoj</item>
<item quantity="one">%2$s %1$d paĝo</item>
<item quantity="other">%2$s %1$d paĝoj</item>
</plurals>
<plurals name="num_pages">
<item quantity="one">%1$d paĝo</item>

View file

@ -36,9 +36,9 @@
<item quantity="other">%1$d páginas</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d página</item>
<item quantity="many">%2$s, %1$d páginas</item>
<item quantity="other">%2$s, %1$d páginas</item>
<item quantity="one">%2$s %1$d página</item>
<item quantity="many">%2$s %1$d páginas</item>
<item quantity="other">%2$s %1$d páginas</item>
</plurals>
<plurals name="humanize_year">
<item quantity="one">hace %1$d año</item>

View file

@ -41,8 +41,8 @@
<item quantity="other">%1$d na mga pahina</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d na pahina</item>
<item quantity="other">%2$s, %1$d na mga pahina</item>
<item quantity="one">%2$s %1$d na pahina</item>
<item quantity="other">%2$s %1$d na mga pahina</item>
</plurals>
<plurals name="humanize_year">
<item quantity="one">%1$d taon ang nakalipas</item>

View file

@ -38,9 +38,9 @@
</plurals>
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d page</item>
<item quantity="many">%2$s, %1$d pages</item>
<item quantity="other">%2$s, %1$d pages</item>
<item quantity="one">%2$s %1$d page</item>
<item quantity="many">%2$s %1$d pages</item>
<item quantity="other">%2$s %1$d pages</item>
</plurals>
<!-- Humanize time -->
<plurals name="humanize_year">

View file

@ -6,9 +6,9 @@
<item quantity="other">%1$d stranica</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d stranica</item>
<item quantity="few">%2$s, %1$d stranice</item>
<item quantity="other">%2$s, %1$d stranica</item>
<item quantity="one">%2$s %1$d stranica</item>
<item quantity="few">%2$s %1$d stranice</item>
<item quantity="other">%2$s %1$d stranica</item>
</plurals>
<plurals name="cleanup_done">
<item quantity="one">Čišćenje je gotovo. Uklonjena je %d mapa</item>

View file

@ -37,8 +37,8 @@
</plurals>
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d page</item>
<item quantity="other">%2$s, %1$d pages</item>
<item quantity="one">%2$s %1$d page</item>
<item quantity="other">%2$s %1$d pages</item>
</plurals>
<!-- Humanize time -->
<plurals name="humanize_year">

View file

@ -33,8 +33,8 @@
</plurals>
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d ページ</item>
<item quantity="other">%2$s, %1$d ページ</item>
<item quantity="one">%2$s %1$d ページ</item>
<item quantity="other">%2$s %1$d ページ</item>
</plurals>
<!-- Humanize time -->
<plurals name="humanize_year">

View file

@ -35,8 +35,8 @@
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d página</item>
<item quantity="other">%2$s, %1$d páginas</item>
<item quantity="one">%2$s %1$d página</item>
<item quantity="other">%2$s %1$d páginas</item>
</plurals>
<!-- Humanize time -->

View file

@ -51,10 +51,10 @@
</plurals>
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d страница</item>
<item quantity="few">%2$s, %1$d страницы</item>
<item quantity="many">%2$s, %1$d страниц</item>
<item quantity="other">%2$s, %1$d страниц</item>
<item quantity="one">%2$s %1$d страница</item>
<item quantity="few">%2$s %1$d страницы</item>
<item quantity="many">%2$s %1$d страниц</item>
<item quantity="other">%2$s %1$d страниц</item>
</plurals>
<!-- Humanize time -->
<plurals name="humanize_year">

View file

@ -33,8 +33,8 @@
<item quantity="other">%1$d பக்கங்கள்</item>
</plurals>
<plurals name="browse_language_and_pages">
<item quantity="one">%2$s, %1$d பக்கம்</item>
<item quantity="other">%2$s, %1$d பக்கங்கள்</item>
<item quantity="one">%2$s %1$d பக்கம்</item>
<item quantity="other">%2$s %1$d பக்கங்கள்</item>
</plurals>
<plurals name="humanize_year">
<item quantity="one">%1$d ஆண்டுக்கு முன்பு</item>

View file

@ -30,7 +30,7 @@
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="other">%2$s, %1$d 页</item>
<item quantity="other">%2$s %1$d 页</item>
</plurals>
<!-- Humanize time -->

View file

@ -27,7 +27,7 @@
</plurals>
<!-- Enhanced E/ExHentai Browse View -->
<plurals name="browse_language_and_pages">
<item quantity="other">%2$s, %1$d 頁</item>
<item quantity="other">%2$s %1$d 頁</item>
</plurals>
<!-- Humanize time -->
<plurals name="humanize_year">