itch.io browse: use itch's own sort, price and platform paths

The sort and price chips now cover everything itch's browse page offers, with the
paths copied from its links: new-and-popular, top-sellers, top-rated and newest
for sorts; free, on-sale, store, 5-dollars-or-less and 15-dollars-or-less for
prices; platform-windows, -osx, -linux, -android, -ios, -web and -mobile-web.
The guessed alternative spelling of the free filter is gone, so a query is one
address. The tests assert the addresses itch itself uses.

New and reworded strings in all 33 locales.
This commit is contained in:
FX192 committed 2026-10-24 09:27:49 +03:00
1 parent cc0a4f5aa9
commit dbcbf0b6fa
37 files changed
+244 -106

No files matched your search

@@ -24,15 +24,22 @@ internal class BrowsePage(val items: List<CatalogItem>, val code: Int, val cache
internal object ItchBrowse {
const val SORT_POPULAR = "popular"
const val SORT_NEW = "new"
const val SORT_TOP_RATED = "top-rated"
const val SORT_NEW_POPULAR = "new-and-popular"
const val SORT_TOP_SELLERS = "top-sellers"
val sorts = listOf(SORT_POPULAR, SORT_NEW, SORT_TOP_RATED, SORT_TOP_SELLERS)
const val SORT_TOP_RATED = "top-rated"
const val SORT_NEWEST = "newest"
val sorts = listOf(SORT_POPULAR, SORT_NEW_POPULAR, SORT_TOP_SELLERS, SORT_TOP_RATED, SORT_NEWEST)
const val PRICE_ANY = "any"
const val PRICE_FREE = "free"
const val PRICE_SALE = "sale"
val prices = listOf(PRICE_ANY, PRICE_FREE, PRICE_SALE)
const val PRICE_SALE = "on-sale"
const val PRICE_PAID = "store"
const val PRICE_UNDER_5 = "5-dollars-or-less"
const val PRICE_UNDER_15 = "15-dollars-or-less"
val prices = listOf(PRICE_ANY, PRICE_FREE, PRICE_SALE, PRICE_PAID, PRICE_UNDER_5, PRICE_UNDER_15)
/** Platform names as itch spells them in `platform-<name>`. */
val platformNames = listOf("windows", "osx", "linux", "android", "ios", "web", "mobile-web")
private const val BASE = "https://itch.io/games"
private const val FRESH_MS = 3 * 60 * 60 * 1000L
@@ -43,52 +50,34 @@ internal object ItchBrowse {
@Volatile private var lastRequestAt = 0L
private val lock = Any()
private fun sortSegment(sort: String): String? = when (sort) {
SORT_NEW -> "newest"
SORT_TOP_RATED -> "top-rated"
SORT_TOP_SELLERS -> "top-sellers"
else -> null
}
/** The path piece itch uses for each choice; the default sort and price have none. */
private fun sortSegment(sort: String): String? = sort.takeIf { it != SORT_POPULAR && it in sorts }
/** The ways itch spells a price filter; the first that answers is used, so one wrong guess does not empty the tab. */
private fun priceSegments(price: String): List<String?> = when (price) {
PRICE_FREE -> listOf("free", "price-free")
PRICE_SALE -> listOf("on-sale")
else -> listOf(null)
}
private fun priceSegment(price: String): String? = price.takeIf { it != PRICE_ANY && it in prices }
/** Every feed URL that could answer [query] for [page], most likely first. */
fun urls(query: BrowseQuery, page: Int): List<String> = priceSegments(query.price).map { price ->
val segments = listOfNotNull(sortSegment(query.sort), price) +
/** The address of [query]'s page on itch: sort, price, platforms, then tags, as itch's own links spell them. */
fun path(query: BrowseQuery): String {
val segments = listOfNotNull(sortSegment(query.sort), priceSegment(query.price)) +
query.platforms.sorted().map { "platform-$it" } +
query.tags.map { "tag-" + tagSlug(it) }
val path = if (segments.isEmpty()) BASE else BASE + "/" + segments.joinToString("/")
path + ".xml" + if (page > 1) "?page=$page" else ""
return if (segments.isEmpty()) BASE else BASE + "/" + segments.joinToString("/")
}
/** The listing feed for [query]'s [page]. */
fun url(query: BrowseQuery, page: Int): String = path(query) + ".xml" + if (page > 1) "?page=$page" else ""
fun tagSlug(tag: String): String = tag.trim().lowercase().replace(Regex("[^a-z0-9]+"), "-").trim('-')
/** Page [page] of [query]: the disk copy when it is fresh, otherwise the feed, one request at a time and spaced out. */
fun page(context: Context, query: BrowseQuery, page: Int, force: Boolean = false): BrowsePage {
val app = context.applicationContext
val candidates = urls(query, page)
if (!force) for (url in candidates) {
val stored = read(app, url) ?: continue
return BrowsePage(stored, 200, true)
}
var code = 0
for (url in candidates) {
val (status, body) = fetch(url)
code = status
if (status !in 200..299 || body == null) continue
val items = ItchShelves.parse(body)
StoresState.logLine("itch.io browse: $url answered $status with ${items.size} games")
if (items.isEmpty()) continue
write(app, url, items)
return BrowsePage(items, status, false)
}
StoresState.logLine("itch.io browse: ${candidates.first()} gave nothing (last status $code)")
return BrowsePage(emptyList(), code, false)
val url = url(query, page)
if (!force) read(app, url)?.let { return BrowsePage(it, 200, true) }
val (status, body) = fetch(url)
val items = if (status in 200..299 && body != null) ItchShelves.parse(body) else emptyList()
StoresState.logLine("itch.io browse: $url answered $status with ${items.size} games")
if (items.isNotEmpty()) write(app, url, items)
return BrowsePage(items, status, false)
}
private fun fetch(url: String): Pair<Int, String?> {
@@ -90,9 +90,10 @@ private fun BrowseChip(label: String, selected: Boolean, onClick: () -> Unit) {
@Composable
private fun sortLabel(sort: String): String = stringResource(
when (sort) {
ItchBrowse.SORT_NEW -> R.string.stores_itch_sort_new
ItchBrowse.SORT_TOP_RATED -> R.string.stores_itch_sort_top_rated
ItchBrowse.SORT_NEW_POPULAR -> R.string.stores_itch_sort_new_popular
ItchBrowse.SORT_TOP_SELLERS -> R.string.stores_itch_sort_top_sellers
ItchBrowse.SORT_TOP_RATED -> R.string.stores_itch_sort_top_rated
ItchBrowse.SORT_NEWEST -> R.string.stores_itch_sort_new
else -> R.string.stores_itch_sort_popular
},
)
@@ -102,6 +103,9 @@ private fun priceLabel(price: String): String = stringResource(
when (price) {
ItchBrowse.PRICE_FREE -> R.string.stores_itch_price_free
ItchBrowse.PRICE_SALE -> R.string.stores_itch_price_sale
ItchBrowse.PRICE_PAID -> R.string.stores_itch_price_paid
ItchBrowse.PRICE_UNDER_5 -> R.string.stores_itch_price_under_5
ItchBrowse.PRICE_UNDER_15 -> R.string.stores_itch_price_under_15
else -> R.string.stores_itch_price_any
},
)
+5 -1
View File
@@ -2089,7 +2089,11 @@
<string name="stores_itch_extract_failed">تعذر استخراج التنزيل (رمز الخروج %1$d)</string>
<string name="stores_itch_no_catalog">لم يستجب itch.io</string>
<string name="stores_itch_sort_popular">الأكثر شعبية</string>
<string name="stores_itch_sort_new">الجديد</string>
<string name="stores_itch_sort_new">الأحدث</string>
<string name="stores_itch_sort_new_popular">جديد ورائج</string>
<string name="stores_itch_price_paid">مدفوع</string>
<string name="stores_itch_price_under_5">5 دولارات أو أقل</string>
<string name="stores_itch_price_under_15">15 دولارًا أو أقل</string>
<string name="stores_itch_sort_top_rated">الأعلى تقييمًا</string>
<string name="stores_itch_sort_top_sellers">الأكثر مبيعًا</string>
<string name="stores_itch_price_any">أي سعر</string>
+5 -1
View File
@@ -2772,7 +2772,11 @@
<string name="stores_itch_extract_failed">No se pudo extraer la descarga (salida %1$d)</string>
<string name="stores_itch_no_catalog">itch.io no respondió</string>
<string name="stores_itch_sort_popular">Populares</string>
<string name="stores_itch_sort_new">Nuevos</string>
<string name="stores_itch_sort_new">Más recientes</string>
<string name="stores_itch_sort_new_popular">Nuevos y populares</string>
<string name="stores_itch_price_paid">De pago</string>
<string name="stores_itch_price_under_5">$5 o menos</string>
<string name="stores_itch_price_under_15">$15 o menos</string>
<string name="stores_itch_sort_top_rated">Mejor valorados</string>
<string name="stores_itch_sort_top_sellers">Más vendidos</string>
<string name="stores_itch_price_any">Cualquier precio</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Изтеглянето не можа да бъде разархивирано (код %1$d)</string>
<string name="stores_itch_no_catalog">itch.io не отговори</string>
<string name="stores_itch_sort_popular">Популярни</string>
<string name="stores_itch_sort_new">Нови</string>
<string name="stores_itch_sort_new">Най-нови</string>
<string name="stores_itch_sort_new_popular">Нови и популярни</string>
<string name="stores_itch_price_paid">Платени</string>
<string name="stores_itch_price_under_5">До $5</string>
<string name="stores_itch_price_under_15">До $15</string>
<string name="stores_itch_sort_top_rated">Най-високо оценени</string>
<string name="stores_itch_sort_top_sellers">Най-продавани</string>
<string name="stores_itch_price_any">Всякаква цена</string>
+5 -1
View File
@@ -2047,7 +2047,11 @@
<string name="stores_itch_extract_failed">Stažený soubor nelze rozbalit (kód %1$d)</string>
<string name="stores_itch_no_catalog">itch.io neodpovědělo</string>
<string name="stores_itch_sort_popular">Populární</string>
<string name="stores_itch_sort_new">Nové</string>
<string name="stores_itch_sort_new">Nejnovější</string>
<string name="stores_itch_sort_new_popular">Nové a populární</string>
<string name="stores_itch_price_paid">Placené</string>
<string name="stores_itch_price_under_5">Do $5</string>
<string name="stores_itch_price_under_15">Do $15</string>
<string name="stores_itch_sort_top_rated">Nejlépe hodnocené</string>
<string name="stores_itch_sort_top_sellers">Nejprodávanější</string>
<string name="stores_itch_price_any">Jakákoli cena</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Downloaden kunne ikke udpakkes (kode %1$d)</string>
<string name="stores_itch_no_catalog">itch.io svarede ikke</string>
<string name="stores_itch_sort_popular">Populære</string>
<string name="stores_itch_sort_new">Nye</string>
<string name="stores_itch_sort_new">Seneste</string>
<string name="stores_itch_sort_new_popular">Nye og populære</string>
<string name="stores_itch_price_paid">Betalt</string>
<string name="stores_itch_price_under_5">$5 eller mindre</string>
<string name="stores_itch_price_under_15">$15 eller mindre</string>
<string name="stores_itch_sort_top_rated">Bedst bedømte</string>
<string name="stores_itch_sort_top_sellers">Mest solgte</string>
<string name="stores_itch_price_any">Alle priser</string>
+5 -1
View File
@@ -1997,7 +1997,11 @@
<string name="stores_itch_extract_failed">Download konnte nicht entpackt werden (Code %1$d)</string>
<string name="stores_itch_no_catalog">itch.io hat nicht geantwortet</string>
<string name="stores_itch_sort_popular">Beliebt</string>
<string name="stores_itch_sort_new">Neu</string>
<string name="stores_itch_sort_new">Neueste</string>
<string name="stores_itch_sort_new_popular">Neu und beliebt</string>
<string name="stores_itch_price_paid">Kostenpflichtig</string>
<string name="stores_itch_price_under_5">5 $ oder weniger</string>
<string name="stores_itch_price_under_15">15 $ oder weniger</string>
<string name="stores_itch_sort_top_rated">Bestbewertet</string>
<string name="stores_itch_sort_top_sellers">Meistverkauft</string>
<string name="stores_itch_price_any">Beliebiger Preis</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Δεν ήταν δυνατή η αποσυμπίεση της λήψης (κωδικός %1$d)</string>
<string name="stores_itch_no_catalog">Το itch.io δεν απάντησε</string>
<string name="stores_itch_sort_popular">Δημοφιλή</string>
<string name="stores_itch_sort_new">Νέα</string>
<string name="stores_itch_sort_new">Πιο πρόσφατα</string>
<string name="stores_itch_sort_new_popular">Νέα και δημοφιλή</string>
<string name="stores_itch_price_paid">Επί πληρωμή</string>
<string name="stores_itch_price_under_5">$5 ή λιγότερο</string>
<string name="stores_itch_price_under_15">$15 ή λιγότερο</string>
<string name="stores_itch_sort_top_rated">Κορυφαία βαθμολογία</string>
<string name="stores_itch_sort_top_sellers">Μπεστ σέλερ</string>
<string name="stores_itch_price_any">Οποιαδήποτε τιμή</string>
+5 -1
View File
@@ -2028,7 +2028,11 @@
<string name="stores_itch_extract_failed">No se ha podido extraer la descarga (código %1$d)</string>
<string name="stores_itch_no_catalog">itch.io no respondió</string>
<string name="stores_itch_sort_popular">Populares</string>
<string name="stores_itch_sort_new">Novedades</string>
<string name="stores_itch_sort_new">Más recientes</string>
<string name="stores_itch_sort_new_popular">Nuevos y populares</string>
<string name="stores_itch_price_paid">De pago</string>
<string name="stores_itch_price_under_5">5 $ o menos</string>
<string name="stores_itch_price_under_15">15 $ o menos</string>
<string name="stores_itch_sort_top_rated">Mejor valorados</string>
<string name="stores_itch_sort_top_sellers">Más vendidos</string>
<string name="stores_itch_price_any">Cualquier precio</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Latausta ei voitu purkaa (koodi %1$d)</string>
<string name="stores_itch_no_catalog">itch.io ei vastannut</string>
<string name="stores_itch_sort_popular">Suositut</string>
<string name="stores_itch_sort_new">Uudet</string>
<string name="stores_itch_sort_new">Uusimmat</string>
<string name="stores_itch_sort_new_popular">Uudet ja suositut</string>
<string name="stores_itch_price_paid">Maksulliset</string>
<string name="stores_itch_price_under_5">Enintään 5 $</string>
<string name="stores_itch_price_under_15">Enintään 15 $</string>
<string name="stores_itch_sort_top_rated">Parhaiten arvioidut</string>
<string name="stores_itch_sort_top_sellers">Myydyimmät</string>
<string name="stores_itch_price_any">Mikä tahansa hinta</string>
+5 -1
View File
@@ -2028,7 +2028,11 @@
<string name="stores_itch_extract_failed">Impossible d\'extraire le téléchargement (code %1$d)</string>
<string name="stores_itch_no_catalog">itch.io n\'a pas répondu</string>
<string name="stores_itch_sort_popular">Populaires</string>
<string name="stores_itch_sort_new">Nouveautés</string>
<string name="stores_itch_sort_new">Plus récents</string>
<string name="stores_itch_sort_new_popular">Nouveautés populaires</string>
<string name="stores_itch_price_paid">Payants</string>
<string name="stores_itch_price_under_5">5 $ ou moins</string>
<string name="stores_itch_price_under_15">15 $ ou moins</string>
<string name="stores_itch_sort_top_rated">Les mieux notés</string>
<string name="stores_itch_sort_top_sellers">Meilleures ventes</string>
<string name="stores_itch_price_any">Tous les prix</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">डाउनलोड एक्सट्रैक्ट नहीं हो सका (कोड %1$d)</string>
<string name="stores_itch_no_catalog">itch.io ने जवाब नहीं दिया</string>
<string name="stores_itch_sort_popular">लोकप्रिय</string>
<string name="stores_itch_sort_new">नए</string>
<string name="stores_itch_sort_new">सबसे हाल के</string>
<string name="stores_itch_sort_new_popular">नए और लोकप्रिय</string>
<string name="stores_itch_price_paid">सशुल्क</string>
<string name="stores_itch_price_under_5">$5 या कम</string>
<string name="stores_itch_price_under_15">$15 या कम</string>
<string name="stores_itch_sort_top_rated">सबसे ऊँची रेटिंग</string>
<string name="stores_itch_sort_top_sellers">सबसे ज़्यादा बिकने वाले</string>
<string name="stores_itch_price_any">कोई भी कीमत</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">A letöltés nem bontható ki (kód: %1$d)</string>
<string name="stores_itch_no_catalog">Az itch.io nem válaszolt</string>
<string name="stores_itch_sort_popular">Népszerű</string>
<string name="stores_itch_sort_new">Új</string>
<string name="stores_itch_sort_new">Legfrissebb</string>
<string name="stores_itch_sort_new_popular">Új és népszerű</string>
<string name="stores_itch_price_paid">Fizetős</string>
<string name="stores_itch_price_under_5">Legfeljebb 5 $</string>
<string name="stores_itch_price_under_15">Legfeljebb 15 $</string>
<string name="stores_itch_sort_top_rated">Legjobbra értékelt</string>
<string name="stores_itch_sort_top_sellers">Legkelendőbb</string>
<string name="stores_itch_price_any">Bármilyen ár</string>
+5 -1
View File
@@ -1984,7 +1984,11 @@
<string name="stores_itch_extract_failed">Tidak dapat mengekstrak unduhan (kode %1$d)</string>
<string name="stores_itch_no_catalog">itch.io tidak menjawab</string>
<string name="stores_itch_sort_popular">Populer</string>
<string name="stores_itch_sort_new">Baru</string>
<string name="stores_itch_sort_new">Terbaru</string>
<string name="stores_itch_sort_new_popular">Baru dan populer</string>
<string name="stores_itch_price_paid">Berbayar</string>
<string name="stores_itch_price_under_5">$5 atau kurang</string>
<string name="stores_itch_price_under_15">$15 atau kurang</string>
<string name="stores_itch_sort_top_rated">Rating tertinggi</string>
<string name="stores_itch_sort_top_sellers">Terlaris</string>
<string name="stores_itch_price_any">Harga apa saja</string>
+5 -1
View File
@@ -2018,7 +2018,11 @@
<string name="stores_itch_extract_failed">Impossibile estrarre il download (codice %1$d)</string>
<string name="stores_itch_no_catalog">itch.io non ha risposto</string>
<string name="stores_itch_sort_popular">Popolari</string>
<string name="stores_itch_sort_new">Novità</string>
<string name="stores_itch_sort_new">Più recenti</string>
<string name="stores_itch_sort_new_popular">Nuovi e popolari</string>
<string name="stores_itch_price_paid">A pagamento</string>
<string name="stores_itch_price_under_5">5 $ o meno</string>
<string name="stores_itch_price_under_15">15 $ o meno</string>
<string name="stores_itch_sort_top_rated">I più votati</string>
<string name="stores_itch_sort_top_sellers">I più venduti</string>
<string name="stores_itch_price_any">Qualsiasi prezzo</string>
+5 -1
View File
@@ -1986,7 +1986,11 @@
<string name="stores_itch_extract_failed">ダウンロードを展開できませんでした (終了コード %1$d)</string>
<string name="stores_itch_no_catalog">itch.io から応答がありません</string>
<string name="stores_itch_sort_popular">人気</string>
<string name="stores_itch_sort_new">新着</string>
<string name="stores_itch_sort_new">新着順</string>
<string name="stores_itch_sort_new_popular">新着&人気</string>
<string name="stores_itch_price_paid">有料</string>
<string name="stores_itch_price_under_5">5ドル以下</string>
<string name="stores_itch_price_under_15">15ドル以下</string>
<string name="stores_itch_sort_top_rated">高評価</string>
<string name="stores_itch_sort_top_sellers">売れ筋</string>
<string name="stores_itch_price_any">すべての価格</string>
+5 -1
View File
@@ -1986,7 +1986,11 @@
<string name="stores_itch_extract_failed">다운로드한 파일의 압축을 풀 수 없습니다(코드 %1$d)</string>
<string name="stores_itch_no_catalog">itch.io가 응답하지 않았습니다</string>
<string name="stores_itch_sort_popular">인기</string>
<string name="stores_itch_sort_new">신규</string>
<string name="stores_itch_sort_new">최신순</string>
<string name="stores_itch_sort_new_popular">신규 및 인기</string>
<string name="stores_itch_price_paid">유료</string>
<string name="stores_itch_price_under_5">$5 이하</string>
<string name="stores_itch_price_under_15">$15 이하</string>
<string name="stores_itch_sort_top_rated">평점 높은 순</string>
<string name="stores_itch_sort_top_sellers">베스트셀러</string>
<string name="stores_itch_price_any">모든 가격</string>
+5 -1
View File
@@ -1984,7 +1984,11 @@
<string name="stores_itch_extract_failed">Tidak dapat mengekstrak muat turun (kod %1$d)</string>
<string name="stores_itch_no_catalog">itch.io tidak menjawab</string>
<string name="stores_itch_sort_popular">Popular</string>
<string name="stores_itch_sort_new">Baharu</string>
<string name="stores_itch_sort_new">Terkini</string>
<string name="stores_itch_sort_new_popular">Baharu dan popular</string>
<string name="stores_itch_price_paid">Berbayar</string>
<string name="stores_itch_price_under_5">$5 atau kurang</string>
<string name="stores_itch_price_under_15">$15 atau kurang</string>
<string name="stores_itch_sort_top_rated">Penilaian tertinggi</string>
<string name="stores_itch_sort_top_sellers">Terlaris</string>
<string name="stores_itch_price_any">Sebarang harga</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Kunne ikke pakke ut nedlastingen (kode %1$d)</string>
<string name="stores_itch_no_catalog">itch.io svarte ikke</string>
<string name="stores_itch_sort_popular">Populære</string>
<string name="stores_itch_sort_new">Nye</string>
<string name="stores_itch_sort_new">Nyeste</string>
<string name="stores_itch_sort_new_popular">Nye og populære</string>
<string name="stores_itch_price_paid">Betalt</string>
<string name="stores_itch_price_under_5">$5 eller mindre</string>
<string name="stores_itch_price_under_15">$15 eller mindre</string>
<string name="stores_itch_sort_top_rated">Best vurdert</string>
<string name="stores_itch_sort_top_sellers">Mest solgt</string>
<string name="stores_itch_price_any">Alle priser</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Download kan niet worden uitgepakt (code %1$d)</string>
<string name="stores_itch_no_catalog">itch.io gaf geen antwoord</string>
<string name="stores_itch_sort_popular">Populair</string>
<string name="stores_itch_sort_new">Nieuw</string>
<string name="stores_itch_sort_new">Meest recent</string>
<string name="stores_itch_sort_new_popular">Nieuw en populair</string>
<string name="stores_itch_price_paid">Betaald</string>
<string name="stores_itch_price_under_5">$5 of minder</string>
<string name="stores_itch_price_under_15">$15 of minder</string>
<string name="stores_itch_sort_top_rated">Hoogst beoordeeld</string>
<string name="stores_itch_sort_top_sellers">Bestverkocht</string>
<string name="stores_itch_price_any">Elke prijs</string>
+5 -1
View File
@@ -2047,7 +2047,11 @@
<string name="stores_itch_extract_failed">Nie można rozpakować pobranego pliku (kod %1$d)</string>
<string name="stores_itch_no_catalog">itch.io nie odpowiedziało</string>
<string name="stores_itch_sort_popular">Popularne</string>
<string name="stores_itch_sort_new">Nowe</string>
<string name="stores_itch_sort_new">Najnowsze</string>
<string name="stores_itch_sort_new_popular">Nowe i popularne</string>
<string name="stores_itch_price_paid">Płatne</string>
<string name="stores_itch_price_under_5">Do 5 $</string>
<string name="stores_itch_price_under_15">Do 15 $</string>
<string name="stores_itch_sort_top_rated">Najwyżej oceniane</string>
<string name="stores_itch_sort_top_sellers">Najlepiej sprzedające się</string>
<string name="stores_itch_price_any">Dowolna cena</string>
+5 -1
View File
@@ -2018,7 +2018,11 @@
<string name="stores_itch_extract_failed">Não foi possível extrair a transferência (código %1$d)</string>
<string name="stores_itch_no_catalog">O itch.io não respondeu</string>
<string name="stores_itch_sort_popular">Populares</string>
<string name="stores_itch_sort_new">Novos</string>
<string name="stores_itch_sort_new">Mais recentes</string>
<string name="stores_itch_sort_new_popular">Novos e populares</string>
<string name="stores_itch_price_paid">Pagos</string>
<string name="stores_itch_price_under_5">5 $ ou menos</string>
<string name="stores_itch_price_under_15">15 $ ou menos</string>
<string name="stores_itch_sort_top_rated">Mais bem avaliados</string>
<string name="stores_itch_sort_top_sellers">Mais vendidos</string>
<string name="stores_itch_price_any">Qualquer preço</string>
+5 -1
View File
@@ -2018,7 +2018,11 @@
<string name="stores_itch_extract_failed">Não foi possível extrair o download (código %1$d)</string>
<string name="stores_itch_no_catalog">O itch.io não respondeu</string>
<string name="stores_itch_sort_popular">Populares</string>
<string name="stores_itch_sort_new">Novos</string>
<string name="stores_itch_sort_new">Mais recentes</string>
<string name="stores_itch_sort_new_popular">Novos e populares</string>
<string name="stores_itch_price_paid">Pagos</string>
<string name="stores_itch_price_under_5">US$ 5 ou menos</string>
<string name="stores_itch_price_under_15">US$ 15 ou menos</string>
<string name="stores_itch_sort_top_rated">Mais bem avaliados</string>
<string name="stores_itch_sort_top_sellers">Mais vendidos</string>
<string name="stores_itch_price_any">Qualquer preço</string>
+5 -1
View File
@@ -2026,7 +2026,11 @@
<string name="stores_itch_extract_failed">Descărcarea nu a putut fi extrasă (cod %1$d)</string>
<string name="stores_itch_no_catalog">itch.io nu a răspuns</string>
<string name="stores_itch_sort_popular">Populare</string>
<string name="stores_itch_sort_new">Noi</string>
<string name="stores_itch_sort_new">Cele mai recente</string>
<string name="stores_itch_sort_new_popular">Noi și populare</string>
<string name="stores_itch_price_paid">Cu plată</string>
<string name="stores_itch_price_under_5">5 $ sau mai puțin</string>
<string name="stores_itch_price_under_15">15 $ sau mai puțin</string>
<string name="stores_itch_sort_top_rated">Cele mai bine cotate</string>
<string name="stores_itch_sort_top_sellers">Cele mai vândute</string>
<string name="stores_itch_price_any">Orice preț</string>
+5 -1
View File
@@ -2049,7 +2049,11 @@
<string name="stores_itch_extract_failed">Не удалось распаковать загрузку (код %1$d)</string>
<string name="stores_itch_no_catalog">itch.io не ответил</string>
<string name="stores_itch_sort_popular">Популярные</string>
<string name="stores_itch_sort_new">Новые</string>
<string name="stores_itch_sort_new">Самые новые</string>
<string name="stores_itch_sort_new_popular">Новые и популярные</string>
<string name="stores_itch_price_paid">Платные</string>
<string name="stores_itch_price_under_5">До $5</string>
<string name="stores_itch_price_under_15">До $15</string>
<string name="stores_itch_sort_top_rated">С лучшими оценками</string>
<string name="stores_itch_sort_top_sellers">Бестселлеры</string>
<string name="stores_itch_price_any">Любая цена</string>
+5 -1
View File
@@ -2005,7 +2005,11 @@
<string name="stores_itch_extract_failed">Det gick inte att packa upp nedladdningen (kod %1$d)</string>
<string name="stores_itch_no_catalog">itch.io svarade inte</string>
<string name="stores_itch_sort_popular">Populära</string>
<string name="stores_itch_sort_new">Nya</string>
<string name="stores_itch_sort_new">Senaste</string>
<string name="stores_itch_sort_new_popular">Nya och populära</string>
<string name="stores_itch_price_paid">Betalda</string>
<string name="stores_itch_price_under_5">$5 eller mindre</string>
<string name="stores_itch_price_under_15">$15 eller mindre</string>
<string name="stores_itch_sort_top_rated">Högst betyg</string>
<string name="stores_itch_sort_top_sellers">Mest sålda</string>
<string name="stores_itch_price_any">Alla priser</string>
+5 -1
View File
@@ -1984,7 +1984,11 @@
<string name="stores_itch_extract_failed">แตกไฟล์ที่ดาวน์โหลดไม่ได้ (รหัส %1$d)</string>
<string name="stores_itch_no_catalog">itch.io ไม่ตอบสนอง</string>
<string name="stores_itch_sort_popular">ยอดนิยม</string>
<string name="stores_itch_sort_new">ใหม่</string>
<string name="stores_itch_sort_new">ล่าสุด</string>
<string name="stores_itch_sort_new_popular">ใหม่และยอดนิยม</string>
<string name="stores_itch_price_paid">เสียเงิน</string>
<string name="stores_itch_price_under_5">ไม่เกิน $5</string>
<string name="stores_itch_price_under_15">ไม่เกิน $15</string>
<string name="stores_itch_sort_top_rated">คะแนนสูงสุด</string>
<string name="stores_itch_sort_top_sellers">ขายดี</string>
<string name="stores_itch_price_any">ทุกราคา</string>
+5 -1
View File
@@ -1999,7 +1999,11 @@
<string name="stores_itch_extract_failed">İndirme ayıklanamadı (kod %1$d)</string>
<string name="stores_itch_no_catalog">itch.io yanıt vermedi</string>
<string name="stores_itch_sort_popular">Popüler</string>
<string name="stores_itch_sort_new">Yeni</string>
<string name="stores_itch_sort_new">En yeniler</string>
<string name="stores_itch_sort_new_popular">Yeni ve popüler</string>
<string name="stores_itch_price_paid">Ücretli</string>
<string name="stores_itch_price_under_5">$5 veya altı</string>
<string name="stores_itch_price_under_15">$15 veya altı</string>
<string name="stores_itch_sort_top_rated">En yüksek puanlı</string>
<string name="stores_itch_sort_top_sellers">En çok satanlar</string>
<string name="stores_itch_price_any">Herhangi bir fiyat</string>
+5 -1
View File
@@ -2047,7 +2047,11 @@
<string name="stores_itch_extract_failed">Не вдалося розпакувати завантаження (код %1$d)</string>
<string name="stores_itch_no_catalog">itch.io не відповів</string>
<string name="stores_itch_sort_popular">Популярні</string>
<string name="stores_itch_sort_new">Нові</string>
<string name="stores_itch_sort_new">Найновіші</string>
<string name="stores_itch_sort_new_popular">Нові й популярні</string>
<string name="stores_itch_price_paid">Платні</string>
<string name="stores_itch_price_under_5">До $5</string>
<string name="stores_itch_price_under_15">До $15</string>
<string name="stores_itch_sort_top_rated">З найвищими оцінками</string>
<string name="stores_itch_sort_top_sellers">Бестселери</string>
<string name="stores_itch_price_any">Будь-яка ціна</string>
+5 -1
View File
@@ -1984,7 +1984,11 @@
<string name="stores_itch_extract_failed">Không thể giải nén bản tải xuống (mã %1$d)</string>
<string name="stores_itch_no_catalog">itch.io không phản hồi</string>
<string name="stores_itch_sort_popular">Phổ biến</string>
<string name="stores_itch_sort_new">Mới</string>
<string name="stores_itch_sort_new">Mới nhất</string>
<string name="stores_itch_sort_new_popular">Mới và phổ biến</string>
<string name="stores_itch_price_paid">Trả phí</string>
<string name="stores_itch_price_under_5">Từ $5 trở xuống</string>
<string name="stores_itch_price_under_15">Từ $15 trở xuống</string>
<string name="stores_itch_sort_top_rated">Đánh giá cao nhất</string>
<string name="stores_itch_sort_top_sellers">Bán chạy nhất</string>
<string name="stores_itch_price_any">Mọi mức giá</string>
+5 -1
View File
@@ -2063,7 +2063,11 @@
<string name="stores_itch_extract_failed">无法解压下载内容(代码 %1$d)</string>
<string name="stores_itch_no_catalog">itch.io 没有响应</string>
<string name="stores_itch_sort_popular">热门</string>
<string name="stores_itch_sort_new">最新</string>
<string name="stores_itch_sort_new">最新发布</string>
<string name="stores_itch_sort_new_popular">新品与热门</string>
<string name="stores_itch_price_paid">付费</string>
<string name="stores_itch_price_under_5">5 美元以下</string>
<string name="stores_itch_price_under_15">15 美元以下</string>
<string name="stores_itch_sort_top_rated">评分最高</string>
<string name="stores_itch_sort_top_sellers">热销</string>
<string name="stores_itch_price_any">任意价格</string>
+5 -1
View File
@@ -1987,7 +1987,11 @@
<string name="stores_itch_extract_failed">無法解壓下載內容(代碼 %1$d)</string>
<string name="stores_itch_no_catalog">itch.io 沒有回應</string>
<string name="stores_itch_sort_popular">熱門</string>
<string name="stores_itch_sort_new">最新</string>
<string name="stores_itch_sort_new">最新發布</string>
<string name="stores_itch_sort_new_popular">新品與熱門</string>
<string name="stores_itch_price_paid">付費</string>
<string name="stores_itch_price_under_5">5 美元以下</string>
<string name="stores_itch_price_under_15">15 美元以下</string>
<string name="stores_itch_sort_top_rated">評分最高</string>
<string name="stores_itch_sort_top_sellers">熱賣</string>
<string name="stores_itch_price_any">任何價格</string>
+5 -1
View File
@@ -1987,7 +1987,11 @@
<string name="stores_itch_extract_failed">無法解壓縮下載內容(代碼 %1$d)</string>
<string name="stores_itch_no_catalog">itch.io 沒有回應</string>
<string name="stores_itch_sort_popular">熱門</string>
<string name="stores_itch_sort_new">最新</string>
<string name="stores_itch_sort_new">最新發布</string>
<string name="stores_itch_sort_new_popular">新品與熱門</string>
<string name="stores_itch_price_paid">付費</string>
<string name="stores_itch_price_under_5">5 美元以下</string>
<string name="stores_itch_price_under_15">15 美元以下</string>
<string name="stores_itch_sort_top_rated">評分最高</string>
<string name="stores_itch_sort_top_sellers">熱銷</string>
<string name="stores_itch_price_any">任何價格</string>
+5 -1
View File
@@ -2082,7 +2082,11 @@
<string name="stores_itch_extract_failed">Could not extract the download (exit %1$d)</string>
<string name="stores_itch_no_catalog">itch.io did not answer</string>
<string name="stores_itch_sort_popular">Popular</string>
<string name="stores_itch_sort_new">New</string>
<string name="stores_itch_sort_new">Most recent</string>
<string name="stores_itch_sort_new_popular">New &amp; popular</string>
<string name="stores_itch_price_paid">Paid</string>
<string name="stores_itch_price_under_5">$5 or less</string>
<string name="stores_itch_price_under_15">$15 or less</string>
<string name="stores_itch_sort_top_rated">Top rated</string>
<string name="stores_itch_sort_top_sellers">Top sellers</string>
<string name="stores_itch_price_any">Any price</string>
@@ -5,50 +5,61 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
/** Every address here was copied from itch.io's own links, not worked out. */
class ItchBrowseTest {
private fun path(sort: String = ItchBrowse.SORT_POPULAR, price: String = ItchBrowse.PRICE_ANY, platforms: Set<String> = emptySet(), tags: List<String> = emptyList()) =
ItchBrowse.path(BrowseQuery(sort, price, platforms, tags))
@Test fun theDefaultQueryIsTheFrontPage() {
assertTrue(BrowseQuery().isDefault)
assertFalse(BrowseQuery(sort = ItchBrowse.SORT_NEW).isDefault)
assertFalse(BrowseQuery(sort = ItchBrowse.SORT_NEWEST).isDefault)
assertFalse(BrowseQuery(price = ItchBrowse.PRICE_FREE).isDefault)
}
@Test fun sortsMapToTheirFeedPaths() {
assertEquals(listOf("https://itch.io/games.xml"), ItchBrowse.urls(BrowseQuery(), 1))
assertEquals(listOf("https://itch.io/games/newest.xml"), ItchBrowse.urls(BrowseQuery(sort = ItchBrowse.SORT_NEW), 1))
assertEquals(listOf("https://itch.io/games/top-rated.xml"), ItchBrowse.urls(BrowseQuery(sort = ItchBrowse.SORT_TOP_RATED), 1))
assertEquals(listOf("https://itch.io/games/top-sellers.xml"), ItchBrowse.urls(BrowseQuery(sort = ItchBrowse.SORT_TOP_SELLERS), 1))
@Test fun sortsUseItchsOwnPaths() {
assertEquals("https://itch.io/games", path())
assertEquals("https://itch.io/games/new-and-popular", path(sort = ItchBrowse.SORT_NEW_POPULAR))
assertEquals("https://itch.io/games/top-sellers", path(sort = ItchBrowse.SORT_TOP_SELLERS))
assertEquals("https://itch.io/games/top-rated", path(sort = ItchBrowse.SORT_TOP_RATED))
assertEquals("https://itch.io/games/newest", path(sort = ItchBrowse.SORT_NEWEST))
}
@Test fun pagesAfterTheFirstCarryThePageNumber() {
assertEquals(listOf("https://itch.io/games/newest.xml?page=3"), ItchBrowse.urls(BrowseQuery(sort = ItchBrowse.SORT_NEW), 3))
@Test fun pricesUseItchsOwnPaths() {
assertEquals("https://itch.io/games/free", path(price = ItchBrowse.PRICE_FREE))
assertEquals("https://itch.io/games/on-sale", path(price = ItchBrowse.PRICE_SALE))
assertEquals("https://itch.io/games/store", path(price = ItchBrowse.PRICE_PAID))
assertEquals("https://itch.io/games/5-dollars-or-less", path(price = ItchBrowse.PRICE_UNDER_5))
assertEquals("https://itch.io/games/15-dollars-or-less", path(price = ItchBrowse.PRICE_UNDER_15))
}
@Test fun aPriceFilterOffersEverySpellingInOrder() {
val free = ItchBrowse.urls(BrowseQuery(sort = ItchBrowse.SORT_TOP_RATED, price = ItchBrowse.PRICE_FREE), 1)
assertEquals(listOf("https://itch.io/games/top-rated/free.xml", "https://itch.io/games/top-rated/price-free.xml"), free)
assertEquals(listOf("https://itch.io/games/on-sale.xml"), ItchBrowse.urls(BrowseQuery(price = ItchBrowse.PRICE_SALE), 1))
}
@Test fun platformsAndTagsFollowTheSortAndPriceInAFixedOrder() {
val query = BrowseQuery(
sort = ItchBrowse.SORT_NEW, price = ItchBrowse.PRICE_SALE,
platforms = setOf("web", "linux"), tags = listOf("Pixel Art", "Horror"),
@Test fun platformsUseItchsOwnNames() {
val expected = mapOf(
"windows" to "platform-windows", "osx" to "platform-osx", "linux" to "platform-linux", "android" to "platform-android",
"ios" to "platform-ios", "web" to "platform-web", "mobile-web" to "platform-mobile-web",
)
assertEquals(expected.keys.toList(), ItchBrowse.platformNames)
for ((name, segment) in expected) assertEquals("https://itch.io/games/$segment", path(platforms = setOf(name)))
}
@Test fun aSortAPriceAndAPlatformCombineInThatOrder() {
assertEquals(
listOf("https://itch.io/games/newest/on-sale/platform-linux/platform-web/tag-pixel-art/tag-horror.xml"),
ItchBrowse.urls(query, 1),
"https://itch.io/games/top-rated/free/platform-windows",
path(ItchBrowse.SORT_TOP_RATED, ItchBrowse.PRICE_FREE, setOf("windows")),
)
}
@Test fun tagsBecomeSlugs() {
@Test fun aTagIsItsLowercaseNameWithHyphens() {
assertEquals("https://itch.io/games/tag-pixel-art", path(tags = listOf("Pixel Art")))
assertEquals("pixel-art", ItchBrowse.tagSlug(" Pixel Art "))
assertEquals("2d", ItchBrowse.tagSlug("2D"))
assertEquals("sci-fi", ItchBrowse.tagSlug("Sci-Fi!"))
}
@Test fun theSamePlatformsInAnyOrderGiveTheSameUrl() {
val a = ItchBrowse.urls(BrowseQuery(platforms = setOf("web", "linux")), 1)
val b = ItchBrowse.urls(BrowseQuery(platforms = setOf("linux", "web")), 1)
assertEquals(a, b)
@Test fun theSamePlatformsInAnyOrderGiveTheSameAddress() {
assertEquals(path(platforms = setOf("web", "linux")), path(platforms = setOf("linux", "web")))
}
@Test fun laterPagesAskForThePageNumberAndTheFirstDoesNot() {
val query = BrowseQuery(sort = ItchBrowse.SORT_TOP_RATED)
assertEquals("https://itch.io/games/top-rated.xml", ItchBrowse.url(query, 1))
assertEquals("https://itch.io/games/top-rated.xml?page=2", ItchBrowse.url(query, 2))
}
}