Add translations for 23 more languages and fill missing strings (#669)

* Add translations for 23 more languages and fill missing strings

* Translate the strings added in main into every language

Cardboard VR and the session drawer's component downloads in all 31
languages, the game details facts and HowLongToBeat labels in the 23 new
ones, and the reworded Components page note there.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-13 13:34:00 -04:00
1 parent 9a6d48c04b
commit 69e68a5008
45 files changed
+57044 -1053

No files matched your search

@@ -22,7 +22,11 @@ object AppLanguage {
const val SYSTEM = ""
/** The languages the app ships, as BCP 47 tags, in the order the picker lists them. */
val supported: List<String> = listOf("en", "es", "fr", "ru", "ja", "ko", "zh-CN", "zh-TW", "zh-HK")
val supported: List<String> = listOf(
"en", "id", "ms", "cs", "da", "de", "es", "es-419", "fr", "it", "hu", "nl", "nb", "pl",
"pt-BR", "pt-PT", "ro", "fi", "sv", "vi", "tr", "el", "bg", "ru", "uk", "ar", "hi", "th",
"ja", "ko", "zh-CN", "zh-TW", "zh-HK",
)
private const val PREFS = "language"
private const val KEY = "app_language"
@@ -97,9 +101,18 @@ object AppLanguage {
// 0 leaves it undefined, so only the locale is changed.
private fun override(locale: Locale) = Configuration().apply { fontScale = 0f; setLocales(LocaleList(locale)) }
private val latinAmerica = setOf(
"419", "AR", "BO", "BR", "BZ", "CL", "CO", "CR", "CU", "DO", "EC", "GT", "HN", "MX", "NI", "PA",
"PE", "PR", "PY", "SV", "US", "UY", "VE",
)
/** Which of the app's languages [locale] reads as, or null when the app does not ship it. */
fun supportedTag(locale: Locale): String? = when (locale.language) {
"en", "es", "fr", "ru", "ja", "ko" -> locale.language
"en", "fr", "ru", "ja", "ko", "ms", "cs", "da", "de", "it", "hu", "nl", "nb", "pl", "ro", "fi",
"sv", "vi", "tr", "el", "bg", "uk", "ar", "hi", "th" -> locale.language
"in", "id" -> "id"
"es" -> if (locale.country in latinAmerica) "es-419" else "es"
"pt" -> if (locale.country.isEmpty() || locale.country == "BR") "pt-BR" else "pt-PT"
"zh" -> when {
locale.script == "Hans" -> "zh-CN"
locale.country == "HK" || locale.country == "MO" -> "zh-HK"
@@ -116,9 +129,33 @@ object AppLanguage {
/** A language's name in that language, for the picker: what a reader of it looks for. */
fun nativeName(tag: String): String = when (tag) {
"en" -> "English"
"es" -> "Español"
"id" -> "Bahasa Indonesia"
"ms" -> "Bahasa Melayu"
"cs" -> "Čeština"
"da" -> "Dansk"
"de" -> "Deutsch"
"es" -> "Español (España)"
"es-419" -> "Español (Latinoamérica)"
"fr" -> "Français"
"it" -> "Italiano"
"hu" -> "Magyar"
"nl" -> "Nederlands"
"nb" -> "Norsk bokmål"
"pl" -> "Polski"
"pt-BR" -> "Português (Brasil)"
"pt-PT" -> "Português (Portugal)"
"ro" -> "Română"
"fi" -> "Suomi"
"sv" -> "Svenska"
"vi" -> "Tiếng Việt"
"tr" -> "Türkçe"
"el" -> "Ελληνικά"
"bg" -> "Български"
"ru" -> "Русский"
"uk" -> "Українська"
"ar" -> "العربية"
"hi" -> "हिन्दी"
"th" -> "ไทย"
"ja" -> "日本語"
"ko" -> "한국어"
"zh-CN" -> "简体中文"
@@ -13,6 +13,7 @@ import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.Toast
import com.droiddeck.launcher.R
import com.droiddeck.launcher.input.SteamTouchConfig.Element
import java.util.concurrent.Executors
import kotlin.math.abs
@@ -335,7 +336,7 @@ class SteamTouchControls(
if (editing) {
text.textSize = r * 0.3f
text.color = Color.argb(alpha / 2, 255, 255, 255)
canvas.drawText("Trackpad", x, y - (text.descent() + text.ascent()) / 2, text)
canvas.drawText(context.getString(R.string.deck_surface_trackpad), x, y - (text.descent() + text.ascent()) / 2, text)
}
}
SteamTouchConfig.STEAM -> {
@@ -579,7 +580,7 @@ class SteamTouchControls(
SteamTouchConfig.STEAM -> "STEAM"
SteamTouchConfig.THUMB -> "…"
SteamTouchConfig.KEYBOARD -> "⌨"
SteamTouchConfig.PASTE -> "Paste"
SteamTouchConfig.PASTE -> context.getString(R.string.touch_paste)
SteamTouchConfig.SELECT -> "⧉"
SteamTouchConfig.START -> "☰"
SteamTouchConfig.BUMPER_LEFT -> "LB"
@@ -880,15 +881,15 @@ class SteamTouchControls(
}
private fun controlName(type: Int) = when (type) {
SteamTouchConfig.DPAD -> "D-pad"
SteamTouchConfig.JOYSTICK_LEFT -> "Left stick"
SteamTouchConfig.JOYSTICK_RIGHT -> "Right stick"
SteamTouchConfig.TRACKPAD_LEFT -> "Left trackpad"
SteamTouchConfig.TRACKPAD_RIGHT -> "Right trackpad"
SteamTouchConfig.TRACKPAD_CENTER -> "Trackpad"
SteamTouchConfig.DPAD -> context.getString(R.string.touch_dpad)
SteamTouchConfig.JOYSTICK_LEFT -> context.getString(R.string.touch_left_stick)
SteamTouchConfig.JOYSTICK_RIGHT -> context.getString(R.string.touch_right_stick)
SteamTouchConfig.TRACKPAD_LEFT -> context.getString(R.string.deck_left_trackpad)
SteamTouchConfig.TRACKPAD_RIGHT -> context.getString(R.string.deck_right_trackpad)
SteamTouchConfig.TRACKPAD_CENTER -> context.getString(R.string.deck_surface_trackpad)
SteamTouchConfig.STEAM -> "Steam"
SteamTouchConfig.THUMB -> "Menu"
SteamTouchConfig.KEYBOARD -> "Keyboard"
SteamTouchConfig.THUMB -> context.getString(R.string.touch_menu)
SteamTouchConfig.KEYBOARD -> context.getString(R.string.touch_keyboard)
else -> label(type)
}
@@ -899,22 +900,22 @@ class SteamTouchControls(
val list = android.widget.LinearLayout(context).apply { orientation = android.widget.LinearLayout.VERTICAL; setPadding((12 * density).toInt(), 0, (12 * density).toInt(), 0) }
var close: () -> Unit = {}
val copied = prefs.getString("copiedLayout", null)
fun item(name: String, enabled: Boolean = true, action: () -> Unit) = list.addView(android.widget.Button(context).apply {
text = name
fun item(name: Int, enabled: Boolean = true, action: () -> Unit) = list.addView(android.widget.Button(context).apply {
setText(name)
isAllCaps = false
isEnabled = enabled
setOnClickListener { close(); action(); invalidate() }
})
item("Colour and opacity…") { pickColor() }
item("Copy this layout") {
item(R.string.touch_color_opacity) { pickColor() }
item(R.string.touch_copy_layout) {
prefs.edit().putString("copiedLayout", (editElements + hidden).joinToString(";") {
"${it.type},${it.visible},${it.x},${it.y},${it.xScale},${it.yScale}"
}).apply()
Toast.makeText(context, "Layout copied; paste it into any game's touch layout", Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.touch_layout_copied, Toast.LENGTH_SHORT).show()
}
item("Paste copied layout", copied != null) { pasteLayout(copied ?: "") }
item("Reset to Steam's default") { resetEditSet() }
close = SteamTouchIconPicker.showPanel(host, "Layout", list, listOf("Close" to {}))
item(R.string.touch_paste_layout, copied != null) { pasteLayout(copied ?: "") }
item(R.string.touch_reset_layout) { resetEditSet() }
close = SteamTouchIconPicker.showPanel(host, context.getString(R.string.ctrl_layout), list, listOf(context.getString(R.string.common_close) to {}))
}
/** A copied layout onto this action set: each control the set has takes the copied place. */
@@ -985,11 +986,12 @@ class SteamTouchControls(
RectF(frame.left + l * s, frame.top + t * s, frame.left + r * s, frame.top + b * s)
private fun text(canvas: Canvas, str: String, x: Float, y: Float, size: Float, color: Int = Color.WHITE, bold: Boolean = true,
align: Paint.Align = Paint.Align.CENTER) {
align: Paint.Align = Paint.Align.CENTER, maxWidth: Float = 0f) {
val p = Paint(Paint.ANTI_ALIAS_FLAG).apply {
this.color = color; textSize = size; textAlign = align
typeface = if (bold) android.graphics.Typeface.DEFAULT_BOLD else android.graphics.Typeface.DEFAULT
}
if (maxWidth > 0f) p.measureText(str).let { if (it > maxWidth) p.textSize = size * maxWidth / it }
canvas.drawText(str, x, y - (p.descent() + p.ascent()) / 2, p)
}
@@ -1004,7 +1006,7 @@ class SteamTouchControls(
canvas.drawRoundRect(r, radius, radius, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = line2; style = Paint.Style.STROKE; strokeWidth = 1.2f * s })
}
val ink = when { !enabled -> Color.argb(110, 242, 244, 247); primary -> onAccent; else -> onSurface }
text(canvas, text, r.centerX(), r.centerY(), 14f * s, ink)
text(canvas, text, r.centerX(), r.centerY(), 14f * s, ink, maxWidth = r.width() - 16f * s)
if (enabled) hots += Hot(r, onTap)
}
@@ -1044,7 +1046,7 @@ class SteamTouchControls(
BIG_PICTURE -> "Steam"
else -> gameNames[appId] ?: run {
val app = appId
gameNames[app] = "app $app"
gameNames[app] = context.getString(R.string.touch_app_id, app)
loader.execute {
val name = SteamTouchConfig.gameName(context, app) ?: return@execute
handler.post { gameNames[app] = name; invalidate() }
@@ -1061,7 +1063,7 @@ class SteamTouchControls(
// Header: power (DroidDeck's own menu: stop, settings), the Steam mark, what is running, close.
iconButton(canvas, ref(f, s, 494f, 18f, 531f, 55f), false, { menuOpen = false; onMenu() }) { c, r, col -> drawPower(c, r, col) }
drawMark(canvas, f.left + 104f * s, f.top + 37f * s, 13f * s)
text(canvas, "Touch controls", f.left + 124f * s, f.top + 30f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
text(canvas, context.getString(R.string.touch_title), f.left + 124f * s, f.top + 30f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
text(canvas, gameName(), f.left + 124f * s, f.top + 46f * s, 11f * s, muted, bold = false, align = Paint.Align.LEFT)
closeButton(canvas, f, s) { menuOpen = false }
val controller = options.inputMode != SteamTouchConfig.INPUT_MOUSE
@@ -1071,10 +1073,10 @@ class SteamTouchControls(
m -> SteamTouchConfig.INPUT_MOUSE
else -> SteamTouchConfig.INPUT_CONTROLLER
}))
tile(canvas, ref(f, s, 45f, 81f, 249f, 271f), s, "Touch Controller", controller, { setModes(!controller, mouse || controller) }) { c, r, col ->
tile(canvas, ref(f, s, 45f, 81f, 249f, 271f), s, context.getString(R.string.touch_controller), controller, { setModes(!controller, mouse || controller) }) { c, r, col ->
drawPhonePad(c, r, col)
}
tile(canvas, ref(f, s, 271f, 81f, 475f, 271f), s, "Mouse", mouse, { setModes(controller || mouse, !mouse) }) { c, r, col ->
tile(canvas, ref(f, s, 271f, 81f, 475f, 271f), s, context.getString(R.string.touch_mouse), mouse, { setModes(controller || mouse, !mouse) }) { c, r, col ->
drawMouse(c, r, col, crossed = false)
}
// Under the controller: gyroscope, fade, vibrate on touch.
@@ -1102,10 +1104,13 @@ class SteamTouchControls(
val speed = speeds.indexOfFirst { abs(it - options.trackpadSensitivity) < 0.2f }.coerceAtLeast(1)
iconButton(canvas, ref(f, s, 412f, 278f, 475f, 318f), mouse && relative, {
setOptions(options.copy(trackpadSensitivity = speeds[(speed + 1) % speeds.size]))
}) { c, r, col -> text(c, listOf("Slow", "Normal", "Fast")[speed], r.centerX(), r.centerY(), r.height() * 0.32f, col) }
}) { c, r, col ->
val name = context.getString(listOf(R.string.touch_speed_slow, R.string.touch_speed_normal, R.string.touch_speed_fast)[speed])
text(c, name, r.centerX(), r.centerY(), r.height() * 0.32f, col, maxWidth = r.width() - 6f * s)
}
drawVolume(canvas, f, s)
blueButton(canvas, ref(f, s, 45f, 329f, 249f, 372f), "Edit layout", s, primary = true) { menuOpen = false; startEditing() }
blueButton(canvas, ref(f, s, 271f, 329f, 475f, 372f), "DroidDeck menu", s) { menuOpen = false; onMenu() }
blueButton(canvas, ref(f, s, 45f, 329f, 249f, 372f), context.getString(R.string.touch_edit_layout), s, primary = true) { menuOpen = false; startEditing() }
blueButton(canvas, ref(f, s, 271f, 329f, 475f, 372f), context.getString(R.string.touch_droiddeck_menu), s) { menuOpen = false; onMenu() }
}
private val audio by lazy { context.getSystemService(Context.AUDIO_SERVICE) as android.media.AudioManager }
@@ -1173,7 +1178,7 @@ class SteamTouchControls(
canvas.drawRoundRect(r, radius, radius, Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = if (on) accent else line; style = Paint.Style.STROKE; strokeWidth = (if (on) 2f else 1.2f) * s
})
text(canvas, title, r.left + 16f * s, r.top + 22f * s, 14f * s, onSurface, align = Paint.Align.LEFT)
text(canvas, title, r.left + 16f * s, r.top + 22f * s, 14f * s, onSurface, align = Paint.Align.LEFT, maxWidth = r.width() - 72f * s)
// A switch, top right.
val sw = RectF(r.right - 50f * s, r.top + 12f * s, r.right - 14f * s, r.top + 32f * s)
canvas.drawRoundRect(sw, sw.height() / 2, sw.height() / 2, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = if (on) accent else line2 })
@@ -1181,7 +1186,7 @@ class SteamTouchControls(
Paint(Paint.ANTI_ALIAS_FLAG).apply { color = if (on) onAccent else muted })
val artRect = RectF(r.centerX() - 58f * s, r.top + 62f * s, r.centerX() + 58f * s, r.top + 140f * s)
art(canvas, artRect, if (on) onSurface else muted)
text(canvas, if (on) "On" else "Off", r.left + 16f * s, r.bottom - 18f * s, 12f * s, if (on) accent else muted, bold = false, align = Paint.Align.LEFT)
text(canvas, context.getString(if (on) R.string.touch_on else R.string.touch_off), r.left + 16f * s, r.bottom - 18f * s, 12f * s, if (on) accent else muted, bold = false, align = Paint.Align.LEFT)
hots += Hot(r, toggle)
}
@@ -1194,9 +1199,9 @@ class SteamTouchControls(
closeButton(canvas, f, s) { save() }
val sets = SteamTouchConfig.actionSets(config)
val setName = sets.firstOrNull { it.first == editSet }?.second
val title = if (sets.size > 1 && setName != null) "${gameName()} · $setName" else "${gameName()} ${config.title ?: "Layout"}"
text(canvas, title, f.centerX(), f.top + 30f * s, 14f * s, onSurface)
text(canvas, "Drag controls onto the screen", f.centerX(), f.top + 47f * s, 11f * s, muted, bold = false)
val title = if (sets.size > 1 && setName != null) "${gameName()} · $setName" else "${gameName()} ${config.title ?: context.getString(R.string.ctrl_layout)}"
text(canvas, title, f.centerX(), f.top + 30f * s, 14f * s, onSurface, maxWidth = f.width() - 200f * s)
text(canvas, context.getString(R.string.touch_drag_hint), f.centerX(), f.top + 47f * s, 11f * s, muted, bold = false, maxWidth = f.width() - 200f * s)
if (sets.size > 1) {
arrowPill(canvas, ref(f, s, 120f, 26f, 150f, 44f), -1) { stepEditSet(-1) }
arrowPill(canvas, ref(f, s, 474f, 26f, 504f, 44f), 1) { stepEditSet(1) }
@@ -1251,8 +1256,8 @@ class SteamTouchControls(
shader = android.graphics.RadialGradient(wheel.centerX(), wheel.centerY(), wheel.width() / 2f, Color.WHITE, Color.TRANSPARENT, android.graphics.Shader.TileMode.CLAMP)
})
hots += Hot(wheel, { pickColor() })
blueButton(canvas, ref(f, s, 45f, 329f, 232f, 372f), "Arrange", s, primary = true) { trayOpen = false }
blueButton(canvas, ref(f, s, 254f, 329f, 441f, 372f), "Discard", s) { stopEditing() }
blueButton(canvas, ref(f, s, 45f, 329f, 232f, 372f), context.getString(R.string.touch_arrange), s, primary = true) { trayOpen = false }
blueButton(canvas, ref(f, s, 254f, 329f, 441f, 372f), context.getString(R.string.touch_discard), s) { stopEditing() }
}
private fun arrowPill(canvas: Canvas, r: RectF, dir: Int, onTap: () -> Unit) {
@@ -1290,7 +1295,10 @@ class SteamTouchControls(
return RectF(x - r, y - r, x + r, y + r)
}
private val contextLabels = listOf("Icon", "W−", "W+", "H−", "H+", "Hide")
private val contextLabels by lazy {
listOf(R.string.touch_icon, R.string.touch_narrower, R.string.touch_wider, R.string.touch_shorter, R.string.touch_taller, R.string.touch_hide)
.map(context::getString)
}
private fun contextRects(): List<RectF> {
val e = editElements.getOrNull(selected) ?: return emptyList()
@@ -1313,11 +1321,11 @@ class SteamTouchControls(
canvas.drawRoundRect(m, m.width() * 0.15f, m.width() * 0.15f, p)
drawDots(canvas, m.centerX(), m.centerY() - m.height() * 0.1f, m.width() * 0.5f, Color.WHITE)
hots += Hot(m, { trayOpen = true })
if (saving) text(canvas, "Saving…", width / 2f, height * 0.08f, 22f * max(unit(), 0.6f))
if (saving) text(canvas, context.getString(R.string.touch_saving), width / 2f, height * 0.08f, 22f * max(unit(), 0.6f))
contextRects().forEachIndexed { i, r ->
canvas.drawRoundRect(r, r.height() * 0.3f, r.height() * 0.3f, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = surface })
canvas.drawRoundRect(r, r.height() * 0.3f, r.height() * 0.3f, Paint(Paint.ANTI_ALIAS_FLAG).apply { color = line2; style = Paint.Style.STROKE; strokeWidth = 1.2f })
text(canvas, contextLabels[i], r.centerX(), r.centerY(), r.height() * 0.4f, onSurface, bold = false)
text(canvas, contextLabels[i], r.centerX(), r.centerY(), r.height() * 0.4f, onSurface, bold = false, maxWidth = r.width() - 6f)
hots += Hot(r, { contextTool(i) })
}
}
@@ -1448,12 +1456,14 @@ class SteamTouchControls(
val ref = visual?.ref
val binding = visual?.binding
if (ref == null || binding == null) {
Toast.makeText(context, "This control has no binding in Steam to put an icon on", Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.touch_no_binding, Toast.LENGTH_SHORT).show()
return
}
val name = if (e.type == SteamTouchConfig.DPAD) "D-pad " + listOf("up", "down", "left", "right")[selectedArm] else label(e.type)
val name = if (e.type == SteamTouchConfig.DPAD) {
context.getString(listOf(R.string.touch_dpad_up, R.string.touch_dpad_down, R.string.touch_dpad_left, R.string.touch_dpad_right)[selectedArm])
} else label(e.type)
val host = parent as? android.view.ViewGroup ?: return
SteamTouchIconPicker(context, host, appId, "Icon for $name", binding) { picked ->
SteamTouchIconPicker(context, host, appId, context.getString(R.string.touch_icon_for, name), binding) { picked ->
pendingBindings[ref] = picked
rebuildVisuals()
invalidate()
@@ -1480,9 +1490,9 @@ class SteamTouchControls(
}
}, android.widget.LinearLayout.LayoutParams(dp(30), dp(30)).apply { marginEnd = dp(6) })
}
root.addView(android.widget.TextView(context).apply { text = "Colour" })
root.addView(android.widget.TextView(context).apply { setText(R.string.ctrl_color) })
root.addView(android.widget.HorizontalScrollView(context).apply { addView(swatchRow) })
root.addView(android.widget.TextView(context).apply { text = "Opacity"; setPadding(0, dp(12), 0, 0) })
root.addView(android.widget.TextView(context).apply { setText(R.string.ctrl_opacity); setPadding(0, dp(12), 0, 0) })
val opacityRow = android.widget.LinearLayout(context)
listOf(20, 35, 50, 65, 80, 100).forEach { percent ->
opacityRow.addView(android.widget.Button(context).apply {
@@ -1497,7 +1507,7 @@ class SteamTouchControls(
}
root.addView(android.widget.HorizontalScrollView(context).apply { addView(opacityRow) })
val host = parent as? android.view.ViewGroup ?: return
SteamTouchIconPicker.showPanel(host, "Touch layout colour", root, listOf("Done" to {}))
SteamTouchIconPicker.showPanel(host, context.getString(R.string.touch_layout_color), root, listOf(context.getString(R.string.touch_done) to {}))
}
private fun save() {
@@ -1528,11 +1538,11 @@ class SteamTouchControls(
handler.post {
saving = false
if (file == null) {
Toast.makeText(context, "Could not save the touch layout", Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.touch_save_failed, Toast.LENGTH_SHORT).show()
invalidate()
return@post
}
Toast.makeText(context, "Touch layout saved to Steam", Toast.LENGTH_SHORT).show()
Toast.makeText(context, R.string.touch_saved, Toast.LENGTH_SHORT).show()
onSaved()
stopEditing()
reloadConfig()
@@ -21,6 +21,7 @@ import android.widget.HorizontalScrollView
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.droiddeck.launcher.R
import java.util.concurrent.Executors
/**
@@ -50,7 +51,7 @@ class SteamTouchIconPicker(
val root = LinearLayout(context).apply { orientation = LinearLayout.HORIZONTAL; setPadding(dp(16), dp(8), dp(16), 0) }
val left = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL }
val label = EditText(context).apply {
hint = "Label (optional)"
setHint(R.string.touch_label_hint)
setText(current.label)
inputType = InputType.TYPE_CLASS_TEXT
setSingleLine()
@@ -77,21 +78,22 @@ class SteamTouchIconPicker(
setPadding(0, dp(8), 0, 0)
addView(preview, LinearLayout.LayoutParams(dp(56), dp(56)))
addView(TextView(context).apply {
text = if (names.isEmpty()) "Steam's icons were not found" else "${names.size} icons from Steam"
text = if (names.isEmpty()) context.getString(R.string.touch_icons_missing)
else context.resources.getQuantityString(R.plurals.touch_icons_found, names.size, names.size)
setPadding(dp(12), 0, 0, 0)
})
})
left.addView(paletteRow("Icon colour", { foreground }) { foreground = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
left.addView(paletteRow("Button colour", { background }) { background = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
left.addView(paletteRow(context.getString(R.string.touch_icon_color), { foreground }) { foreground = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
left.addView(paletteRow(context.getString(R.string.touch_button_color), { background }) { background = it; adapter.notifyDataSetChanged(); updatePreview(preview) })
root.addView(left, LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f))
root.addView(grid, LinearLayout.LayoutParams(0, dp(250), 1.2f).apply { marginStart = dp(16) })
updatePreview(preview)
showPanel(host, title, root, listOf(
"No icon" to {
context.getString(R.string.touch_no_icon) to {
onPicked(current.copy(label = label.text.toString().replace(",", " ").trim(), icon = "", foreground = "", background = ""))
},
"Cancel" to {},
"Use" to {
context.getString(R.string.common_cancel) to {},
context.getString(R.string.common_use) to {
onPicked(current.copy(label = label.text.toString().replace(",", " ").trim(), icon = icon,
foreground = if (icon.isEmpty()) "" else foreground, background = if (icon.isEmpty()) "" else background))
},
@@ -51,7 +51,7 @@ object AmazonBackend : StoreBackend {
val quiet = cached.isNotEmpty() && !force
StoresState.post {
if (cached.isNotEmpty()) publish(app, cached)
if (!quiet) StoresState.status[store] = "Fetching your library…"
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
}
val result = AmazonLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
StoresState.post {
@@ -94,7 +94,7 @@ object AmazonBackend : StoreBackend {
private val cancelled = AtomicBoolean(false)
override fun run(handle: DownloadQueue.JobHandle): String? {
handle.stage(DownloadStage.MANIFEST, "Checking sign-in…")
handle.stage(DownloadStage.MANIFEST, app.getString(com.droiddeck.launcher.R.string.stores_sync_sign_in))
val token = AmazonCredentialStore.getValidAccessToken(app) ?: throw AmazonDownloadManager.InstallException("Not signed in to Amazon Games")
StoreInstalls.begin(folder, Store.AMAZON, game.productId, game.title, item.tallImageUrl ?: item.imageUrl, item.imageUrl)
var downloading = false
@@ -111,7 +111,7 @@ object AmazonBackend : StoreBackend {
override fun onSizes(downloadBytes: Long, diskBytes: Long) { handle.diskSize(diskBytes) }
}) ?: return null
if (cancelled.get()) return null
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
AmazonLibrary.rememberSize(app, game.productId, result.bytes)
AmazonPrefs.get(app).edit().putString("version_${game.productId}", result.versionId).apply()
val spec = AmazonLaunchHelper.buildLaunchSpec(folder, game.title)
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.stores.amazon
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreNet
@@ -66,38 +67,38 @@ object AmazonLibrary {
val p = AmazonPrefs.get(app)
val cachedList = cached(app)
if (!force && cachedList.isNotEmpty() && System.currentTimeMillis() - p.getLong(LAST_SYNC_KEY, 0L) < THROTTLE_MS) {
backfillPosters(p, cachedList, onStatus)
backfillPosters(app, p, cachedList, onStatus)
return SyncResult.Throttled
}
onStatus("Checking sign-in…")
onStatus(app.getString(R.string.stores_sync_sign_in))
val creds = AmazonCredentialStore.load(app) ?: return SyncResult.NotLoggedIn
val token = AmazonCredentialStore.getValidAccessToken(app) ?: return SyncResult.Failed(StoresState.notSignedInLine(Store.AMAZON))
onStatus("Fetching game list…")
onStatus(app.getString(R.string.stores_sync_game_list))
// Refused with the stored token (revoked, or an expiry read wrong): once more on a fresh one.
val all = AmazonApiClient.getEntitlements(token, creds.deviceSerial)
?: AmazonCredentialStore.refresh(app)?.let { AmazonApiClient.getEntitlements(it, creds.deviceSerial) }
if (all == null) return if (cachedList.isEmpty()) SyncResult.Failed("Amazon Games did not answer for your library: refresh, or sign in again") else SyncResult.Ok(cachedList)
if (all.isEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed("No games found in your Amazon library") else SyncResult.Ok(cachedList)
if (all == null) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_amazon_no_answer)) else SyncResult.Ok(cachedList)
if (all.isEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_no_games, Store.AMAZON.label)) else SyncResult.Ok(cachedList)
val games = all.filter { !(it.isDLC && it.parentProductId.isNotEmpty()) }.ifEmpty { all }
.sortedWith { a, b -> a.title.compareTo(b.title, ignoreCase = true) }
for (fresh in games) cachedList.firstOrNull { it.productId == fresh.productId }?.let { fresh.versionId = it.versionId }
saveCache(p, games)
p.edit().putLong(LAST_SYNC_KEY, System.currentTimeMillis()).apply()
backfillPosters(p, games, onStatus)
backfillPosters(app, p, games, onStatus)
Log.i(TAG, "sync: entitlements=${all.size} games=${games.size}")
return SyncResult.Ok(games)
} catch (e: Exception) {
Log.w(TAG, "sync failed: ${e.message}")
return SyncResult.Failed(e.message ?: "Sync failed")
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
} finally {
syncing.set(false)
}
}
private fun backfillPosters(p: SharedPreferences, games: List<AmazonGame>, onStatus: (String) -> Unit) {
private fun backfillPosters(app: Context, p: SharedPreferences, games: List<AmazonGame>, onStatus: (String) -> Unit) {
val missing = games.filter { it.productId.isNotEmpty() && !p.contains("vcover_${it.productId}") }.take(POSTER_BUDGET)
if (missing.isEmpty()) return
onStatus("Fetching cover art…")
onStatus(app.getString(R.string.stores_sync_cover_art))
val pool = Executors.newFixedThreadPool(4)
val futures = missing.map { g -> pool.submit(Callable { g.productId to StoreNet.sgdbPoster(g.title) }) }
pool.shutdown()
@@ -47,7 +47,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
val quiet = cached.isNotEmpty() && !force
StoresState.post {
if (cached.isNotEmpty()) StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], cached)
if (!quiet) StoresState.status[store] = "Fetching your library…"
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
}
val result = EpicLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
StoresState.post {
@@ -122,7 +122,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
private fun hasChunks(dir: File): Boolean = dir.isDirectory && (dir.list()?.isNotEmpty() == true)
override fun run(handle: DownloadQueue.JobHandle): String? {
handle.stage(DownloadStage.MANIFEST, "Checking sign-in…")
handle.stage(DownloadStage.MANIFEST, app.getString(com.droiddeck.launcher.R.string.stores_sync_sign_in))
val token = EpicCredentialStore.getValidAccessToken(app) ?: throw EpicDownloadManager.InstallException("Not signed in to Epic Games")
StoreInstalls.begin(folder, Store.EPIC, item.id, item.title, item.tallImageUrl ?: item.imageUrl, item.imageUrl)
if (scratch == null && hasChunks(File(folder, ".chunks"))) handle.log("epic: resuming \"${item.title}\" with the chunks already beside it")
@@ -151,7 +151,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
}
}) ?: return null
if (cancelled.get()) return null
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
EpicLibrary.rememberSize(app, item.id, result.bytes)
val deploymentId = runCatching { JSONObject(manifestJson).optString("deploymentId", "") }.getOrDefault("")
val exe = StoreExe.pick(folder, result.launchExe, item.title)
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.stores.epic
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import org.json.JSONArray
@@ -67,17 +68,17 @@ object EpicLibrary {
val cachedList = cached(app)
val lastSync = p.getLong(LAST_SYNC_KEY, 0L)
if (!force && cachedList.isNotEmpty() && System.currentTimeMillis() - lastSync < THROTTLE_MS) return SyncResult.Throttled
onStatus("Checking sign-in…")
onStatus(app.getString(R.string.stores_sync_sign_in))
val token = EpicCredentialStore.getValidAccessToken(app) ?: return SyncResult.NotLoggedIn
onStatus("Fetching game list…")
onStatus(app.getString(R.string.stores_sync_game_list))
val raw = EpicApiClient.getLibraryItems(token)
if (raw.isNullOrEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed("No games found in your Epic library") else SyncResult.Ok(cachedList)
if (raw.isNullOrEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed(app.getString(R.string.stores_sync_no_games, Store.EPIC.label)) else SyncResult.Ok(cachedList)
val total = raw.size
var done = 0
for (game in raw) {
EpicApiClient.enrichFromCatalog(token, game)
done++
if (done % 5 == 0) onStatus("Loading game details… ($done/$total)")
if (done % 5 == 0) onStatus(app.getString(R.string.stores_sync_details, done, total))
}
val main = raw.filter { !it.isDLC }
val display = (if (main.isEmpty()) raw else main).distinctBy { it.appName }.sortedWith { a, b -> a.title.compareTo(b.title, ignoreCase = true) }
@@ -92,7 +93,7 @@ object EpicLibrary {
return SyncResult.Ok(display)
} catch (e: Exception) {
Log.w(TAG, "sync failed: ${e.message}")
return SyncResult.Failed(e.message ?: "Sync failed")
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
} finally {
syncing.set(false)
}
@@ -38,7 +38,7 @@ object GogBackend : StoreBackend {
val quiet = cached.isNotEmpty() && !force
StoresState.post {
if (cached.isNotEmpty()) StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], cached)
if (!quiet) StoresState.status[store] = "Fetching your library…"
if (!quiet) StoresState.status[store] = app.getString(com.droiddeck.launcher.R.string.stores_sync_library)
}
val result = GogLibrary.sync(app, force) { line -> if (!quiet) StoresState.post { StoresState.status[store] = line } }
StoresState.post {
@@ -106,7 +106,7 @@ object GogBackend : StoreBackend {
}
}, cancelled) ?: return null
if (cancelled.get()) return null
handle.stage(DownloadStage.INSTALL, "Registering with Steam…")
handle.stage(DownloadStage.INSTALL, app.getString(com.droiddeck.launcher.R.string.stores_registering))
val sidecar = StoreGameSidecar(
Store.GOG, game.gameId, game.title, exe = result.exeRelative.ifEmpty { "" },
installVersion = result.buildId, installedAt = System.currentTimeMillis(),
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.stores.gog
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreNet
@@ -60,9 +61,9 @@ object GogLibrary {
val app = context.applicationContext
val p = GogPrefs.get(app)
val token = GogAuth.validToken(app) ?: return SyncResult.NotLoggedIn
onStatus("Fetching game list…")
onStatus(app.getString(R.string.stores_sync_game_list))
val gamesJson = StoreNet.get("https://embed.gog.com/user/data/games", bearer = token, userAgent = GogAuth.GALAXY_UA)
?: return SyncResult.Failed("Couldn't reach GOG")
?: return SyncResult.Failed(app.getString(R.string.stores_sync_gog_unreachable))
val ids = ArrayList<String>()
val parsed = runCatching {
val owned = JSONObject(gamesJson).optJSONArray("owned")
@@ -72,7 +73,7 @@ object GogLibrary {
if (id != "1801418160" && id != "0") ids.add(id)
}
}.isSuccess
if (!parsed) return SyncResult.Failed("Error parsing library")
if (!parsed) return SyncResult.Failed(app.getString(R.string.stores_sync_gog_unreadable))
val ownedSet = ids.toHashSet()
val cachedList = cached(app)
@@ -92,7 +93,7 @@ object GogLibrary {
saveCache(p, list)
return SyncResult.Ok(list.sortedBy { it.title.lowercase() }, 0)
}
onStatus("Syncing ${idsToFetch.size} game${if (idsToFetch.size == 1) "" else "s"}…")
onStatus(app.resources.getQuantityString(R.plurals.stores_sync_games, idsToFetch.size, idsToFetch.size))
val pool = Executors.newFixedThreadPool(5)
val futures = idsToFetch.map { id -> pool.submit(Callable<GogGame?> { fetchGame(p, id, token, skipped) }) }
pool.shutdown()
@@ -100,7 +101,7 @@ object GogLibrary {
for ((idx, f) in futures.withIndex()) {
val g = runCatching { f.get() }.getOrNull()
if (g != null) { merged[g.gameId] = g; fetched++ }
if ((idx + 1) % 5 == 0) onStatus("Syncing… ${idx + 1}/${futures.size}")
if ((idx + 1) % 5 == 0) onStatus(app.getString(R.string.stores_sync_progress, idx + 1, futures.size))
}
val finalList = merged.values.toList()
saveCache(p, finalList)
@@ -111,7 +112,7 @@ object GogLibrary {
return SyncResult.Ok(finalList.sortedBy { it.title.lowercase() }, fetched)
} catch (e: Exception) {
Log.w(TAG, "sync failed: ${e.message}")
return SyncResult.Failed(e.message ?: "Sync failed")
return SyncResult.Failed(e.message ?: context.getString(R.string.stores_sync_failed))
} finally {
syncing.set(false)
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="loading_hints">
<item>La primera vez se descarga Steam. Puede tardar unos minutos.</item>
<item>De forma predeterminada, al salir de la app Steam se pausa y continúa donde lo dejaste cuando vuelves.</item>
<item>Tu control aparece como un control de Xbox 360. Si no, usa los controles en pantalla.</item>
</string-array>
<string-array name="loading_hints_desktop">
<item>La primera vez se prepara el escritorio. Puede tardar unos minutos.</item>
<item>De forma predeterminada, al salir de la app la sesión se pausa y continúa donde la dejaste cuando vuelves.</item>
<item>El tacto funciona como un touchpad: arrastra para mover el puntero y toca para hacer clic.</item>
<item>Tu control aparece como un control de Xbox 360. Si no, usa los controles en pantalla.</item>
</string-array>
<string name="second_library_import_hint">Agrega una biblioteca de Steam y busca juegos de Windows en ella. Los juegos que tienes usan sus entradas de Steam; el resto se convierten en accesos directos ajenos a Steam.</string>
<string name="game_env_add">Agregar variable</string>
<string name="game_env_xalia">Pon 0 para desactivar el asistente de navegación con control de Proton en este juego.</string>
<string name="user_apps_add">Agregar</string>
<string name="user_apps_added">%1$s agregada</string>
<string name="user_apps_remove_confirm">Presiona de nuevo para quitar</string>
<string name="user_apps_failed">No se pudo agregar la app</string>
<string name="add_app_title">Agregar una app</string>
<string name="add_app_confirm">Agregar</string>
<string name="common_add_ellipsis">Agregar…</string>
<string name="mode_osc_note">Auto muestra los controles en pantalla cuando no hay ningún control conectado.</string>
<string name="mode_controller">Control</string>
<string name="mode_controller_hint">Cómo ve Steam tu control. Se aplica en la próxima sesión.</string>
<string name="mode_controller_deck">Control de Steam Deck</string>
<string name="mode_controller_x360">Control de Xbox 360</string>
<string name="games_add">Agregar juego</string>
<string name="games_add_title">Agregar un juego:</string>
<string name="mode_storage_note">Los juegos que cargan recursos desde la SD o el almacenamiento compartido pueden tener microcortes.</string>
<string name="comp_no_proton">Aún no hay ningún Proton instalado. Inicia Steam una vez para descargar su Proton ARM64, o agrega GE-Proton o CachyOS desde Configuración.</string>
<string name="perf_gpuclock_hint">Solo Adreno. Menos microcortes, más consumo de batería y calor.</string>
<string name="perf_xalia_hint">Desactiva el asistente de navegación con control de Proton, que consume CPU en cada juego.</string>
<string name="perf_fastpath_hint">Búsquedas de archivos más rápidas y menos microcortes. Desactívalo si un programa no encuentra sus archivos.</string>
<string name="drawer_page_controller">Control</string>
<string name="setup_manage">Administrar</string>
<string name="setup_tab_controller">Control</string>
<string name="setup_sign_in">Presiona Jugar en Steam e inicia sesión</string>
<string name="setup_controller">Control</string>
<string name="setup_controller_unavailable">Los ajustes del control no están disponibles.</string>
<string name="setup_tool_files_hint">Explorar y administrar archivos</string>
<string name="store_setup_text">Agrega Flatpak y lo conecta a Flathub (unos 20 MB). La primera app también descarga su runtime.</string>
<string name="store_press_again">Presiona de nuevo para quitar</string>
<string name="gate_no_toggle">Esta versión de Android no tiene un interruptor para ello, así que DroidDeck lo cambia mediante la Depuración inalámbrica. Tarda un minuto y no necesitas una computadora.</string>
<string name="gate_code_needed">Ventana encontrada. Ingresa su código en la notificación.</string>
<string name="gate_other_toggle">Depuración inalámbrica, dirección manual, ADB desde una computadora</string>
<string name="gate_other_no_toggle">Dirección manual, ADB desde una computadora, Opciones de desarrollador</string>
<string name="gate_some_roms">Algunas ROM agregan el interruptor de todos modos. Busca “procesos secundarios” en Opciones de desarrollador.</string>
<string name="gate_manual_hint">Si la notificación no funciona, ingresa manualmente la dirección y el código de la ventana.</string>
<string name="gate_enter_manually">Ingresar dirección manualmente</string>
<string name="gate_from_computer">Desde una computadora con ADB:</string>
<string name="wadb_enter_port">Vinculado. Ingresa el puerto de Ajustes.</string>
<string name="wadb_computer_last">3 · ADB desde una computadora (último recurso)</string>
<string name="wadb_computer_group">3 · ADB desde una computadora (último recurso)</string>
<string name="ctrl_select_steam">Presiona Select para abrir el menú de Steam</string>
<string name="ctrl_reset_all">Restablecer control</string>
<string name="ctrl_reset_all_hint">Restaura todos los ajustes del control y la disposición</string>
<string name="content_add_roms">Agrega juegos de %1$s a ROMs/%2$s.</string>
<string name="desktop_remove_text">Elimina el escritorio y sus apps incluidas. Se conservan los juegos, las apps agregadas, los ajustes y las bibliotecas compartidas.</string>
<string name="games_manage_saves">Administrar partidas guardadas</string>
<string name="games_added">Juego agregado</string>
<string name="deck_tab_gamepad">Control</string>
<string name="game_shortcut_add">Agregar a la pantalla de inicio</string>
<string name="game_shortcut_unsupported">Este launcher no puede agregar accesos directos. Usa Copiar enlace de inicio.</string>
<string name="session_runtime_catalog_unreachable">No se pudo acceder al catálogo del runtime. Revisa la conexión y vuelve a presionar Jugar.</string>
<string name="session_runtime_install_failed">El runtime de Linux no se instaló. Revisa el runtime en Configuración y vuelve a presionar Jugar.</string>
<string name="session_desktop_install_failed">El escritorio no se instaló (%1$s). Revisa la conexión y presiona Escritorio de nuevo.</string>
<string name="store_cat_audio_video">Audio y video</string>
<string name="theme_graphite_detail">Superficies grafito, con el azul del orbe del logotipo para todo lo seleccionado, enfocado o presionado.</string>
<string name="theme_icon_blue_detail">Fondo negro, texto blanco y el azul para todo lo seleccionado, enfocado o presionado.</string>
<string name="pckb_key_enter">Enter ⏎</string>
<string name="game_sync_err_added_games">La carpeta de juegos agregados no está disponible</string>
<string name="fm_favorite_add">Agregar a Favoritos</string>
<string name="fm_conflict_merge_hint">Combinar agrega y reemplaza archivos dentro de la carpeta existente.</string>
<string name="fm_favorite_added">Se agregó \"%1$s\" a Favoritos</string>
<string name="adbfix_enter_address">Ingresa la dirección IP y el puerto actuales de la Depuración inalámbrica</string>
<string name="adbpair_six_digits">Ingresa los 6 dígitos del código</string>
<string name="adbpair_code_rejected">Ese código no funcionó. Vuelve a abrir la ventana de vinculación e ingresa su nuevo código.</string>
<string name="adbpair_waiting_long">Activa la Depuración inalámbrica y toca “Vincular dispositivo con código de vinculación”. Quédate en Ajustes: el código se ingresa en esta notificación.</string>
<string name="adbpair_code_hint">Toca Ingresar código y escribe los 6 dígitos que muestra Ajustes.</string>
<string name="adbpair_title_code">Ingresa el código de vinculación Wi-Fi</string>
<string name="adbpair_enter_code">Ingresar código</string>
<string name="phantom_instructions_fix">%1$s Si no es posible, conecta este dispositivo a una computadora con ADB y ejecuta el comando de abajo. Después vuelve aquí y comprueba de nuevo.</string>
<string name="stores_kv_steam_on">se agrega a Steam al instalar (interfaz Deck + Steam Input)</string>
<string name="stores_download_manager">Administrador de descargas</string>
<string name="games_add_all">Agregar todos los juegos de esta carpeta</string>
<plurals name="games_added_n">
<item quantity="one">%1$d juego agregado</item>
<item quantity="many">%1$d juegos agregados</item>
<item quantity="other">%1$d juegos agregados</item>
</plurals>
</resources>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+68
View File
@@ -2360,4 +2360,72 @@
<string name="gog_achievements_enable_store">Enable GOG achievements in Stores settings</string>
<string name="gog_achievements_unavailable">Achievements unavailable; check session logs</string>
<string name="achievement_unlocked">Achievement unlocked</string>
<string name="touch_paste">Paste</string>
<string name="touch_dpad">D-pad</string>
<string name="touch_left_stick">Left stick</string>
<string name="touch_right_stick">Right stick</string>
<string name="touch_menu">Menu</string>
<string name="touch_keyboard">Keyboard</string>
<string name="touch_dpad_up">D-pad up</string>
<string name="touch_dpad_down">D-pad down</string>
<string name="touch_dpad_left">D-pad left</string>
<string name="touch_dpad_right">D-pad right</string>
<string name="touch_title">Touch controls</string>
<string name="touch_controller">Touch Controller</string>
<string name="touch_mouse">Mouse</string>
<string name="touch_on">On</string>
<string name="touch_off">Off</string>
<string name="touch_speed_slow">Slow</string>
<string name="touch_speed_normal">Normal</string>
<string name="touch_speed_fast">Fast</string>
<string name="touch_edit_layout">Edit layout</string>
<string name="touch_droiddeck_menu">DroidDeck menu</string>
<string name="touch_drag_hint">Drag controls onto the screen</string>
<string name="touch_arrange">Arrange</string>
<string name="touch_discard">Discard</string>
<string name="touch_saving">Saving…</string>
<string name="touch_icon">Icon</string>
<string name="touch_narrower">W−</string>
<string name="touch_wider">W+</string>
<string name="touch_shorter">H−</string>
<string name="touch_taller">H+</string>
<string name="touch_hide">Hide</string>
<string name="touch_color_opacity">Color and opacity…</string>
<string name="touch_copy_layout">Copy this layout</string>
<string name="touch_layout_copied">Layout copied; paste it into any game\'s touch layout</string>
<string name="touch_paste_layout">Paste copied layout</string>
<string name="touch_reset_layout">Reset to Steam\'s default</string>
<string name="touch_no_binding">This control has no binding in Steam to put an icon on</string>
<string name="touch_icon_for">Icon for %1$s</string>
<string name="touch_layout_color">Touch layout color</string>
<string name="touch_done">Done</string>
<string name="touch_save_failed">Could not save the touch layout</string>
<string name="touch_saved">Touch layout saved to Steam</string>
<string name="touch_app_id">App %1$d</string>
<string name="touch_label_hint">Label (optional)</string>
<string name="touch_icons_missing">Steam\'s icons were not found</string>
<plurals name="touch_icons_found">
<item quantity="one">%1$d icon from Steam</item>
<item quantity="other">%1$d icons from Steam</item>
</plurals>
<string name="touch_icon_color">Icon color</string>
<string name="touch_button_color">Button color</string>
<string name="touch_no_icon">No icon</string>
<string name="stores_sync_sign_in">Checking sign-in…</string>
<string name="stores_sync_library">Fetching your library…</string>
<string name="stores_sync_game_list">Fetching game list…</string>
<string name="stores_sync_details">Loading game details… (%1$d/%2$d)</string>
<plurals name="stores_sync_games">
<item quantity="one">Syncing %1$d game…</item>
<item quantity="other">Syncing %1$d games…</item>
</plurals>
<string name="stores_sync_progress">Syncing… %1$d/%2$d</string>
<string name="stores_sync_cover_art">Fetching cover art…</string>
<string name="stores_sync_failed">Sync failed</string>
<string name="stores_sync_no_games">No games found in your %1$s library</string>
<string name="stores_sync_amazon_no_answer">Amazon Games did not answer for your library: refresh, or sign in again</string>
<string name="stores_sync_gog_unreachable">Couldn\'t reach GOG</string>
<string name="stores_sync_gog_unreadable">Could not read your GOG library</string>
<string name="stores_registering">Registering with Steam…</string>
</resources>
+24
View File
@@ -3,9 +3,33 @@
AppLanguage.supported and the values-* folders. -->
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="id" />
<locale android:name="ms" />
<locale android:name="cs" />
<locale android:name="da" />
<locale android:name="de" />
<locale android:name="es" />
<locale android:name="es-419" />
<locale android:name="fr" />
<locale android:name="it" />
<locale android:name="hu" />
<locale android:name="nl" />
<locale android:name="nb" />
<locale android:name="pl" />
<locale android:name="pt-BR" />
<locale android:name="pt-PT" />
<locale android:name="ro" />
<locale android:name="fi" />
<locale android:name="sv" />
<locale android:name="vi" />
<locale android:name="tr" />
<locale android:name="el" />
<locale android:name="bg" />
<locale android:name="ru" />
<locale android:name="uk" />
<locale android:name="ar" />
<locale android:name="hi" />
<locale android:name="th" />
<locale android:name="ja" />
<locale android:name="ko" />
<locale android:name="zh-CN" />
@@ -0,0 +1,57 @@
package com.droiddeck.launcher.core
import java.io.File
import java.util.Locale
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class AppLanguageTest {
private fun tag(languageTag: String) = AppLanguage.supportedTag(Locale.forLanguageTag(languageTag))
private val folders = mapOf(
"id" to "in", "ms" to "ms", "cs" to "cs", "da" to "da", "de" to "de", "es" to "es",
"es-419" to "b+es+419", "fr" to "fr", "it" to "it", "hu" to "hu", "nl" to "nl", "nb" to "nb",
"pl" to "pl", "pt-BR" to "pt", "pt-PT" to "pt-rPT", "ro" to "ro", "fi" to "fi", "sv" to "sv",
"vi" to "vi", "tr" to "tr", "el" to "el", "bg" to "bg", "ru" to "ru", "uk" to "uk", "ar" to "ar",
"hi" to "hi", "th" to "th", "ja" to "ja", "ko" to "ko", "zh-CN" to "zh-rCN", "zh-TW" to "zh-rTW",
"zh-HK" to "zh-rHK",
)
@Test fun everyLanguageReadsAsItself() {
AppLanguage.supported.forEach { assertEquals(it, tag(it)) }
}
@Test fun everyLanguageHasItsOwnName() {
val names = AppLanguage.supported.map(AppLanguage::nativeName)
assertEquals(names.size, names.toSet().size)
AppLanguage.supported.forEach { assertTrue(it, AppLanguage.nativeName(it) != it) }
}
@Test fun systemLocalesFindTheirLanguage() {
assertEquals("es-419", tag("es-MX"))
assertEquals("es-419", tag("es-US"))
assertEquals("es", tag("es-ES"))
assertEquals("pt-BR", tag("pt-BR"))
assertEquals("pt-BR", tag("pt"))
assertEquals("pt-PT", tag("pt-PT"))
assertEquals("pt-PT", tag("pt-AO"))
assertEquals("id", tag("in-ID"))
assertEquals("id", tag("id-ID"))
assertEquals("de", tag("de-AT"))
assertEquals("ar", tag("ar-EG"))
assertEquals("zh-HK", tag("zh-MO"))
assertNull(tag("sw-KE"))
assertNull(tag("nn-NO"))
}
@Test fun everyLanguageShipsStringsAndIsOfferedToAndroid() {
assertEquals(AppLanguage.supported.toSet() - "en", folders.keys)
val res = File("src/main/res")
folders.values.forEach { assertTrue(it, File(res, "values-$it/strings.xml").isFile) }
val config = File(res, "xml/locales_config.xml").readText()
val offered = Regex("""android:name="([^"]+)"""").findAll(config).map { it.groupValues[1] }.toList()
assertEquals(AppLanguage.supported, offered)
}
}
@@ -18,6 +18,18 @@ class SteamLanguageTest {
assertEquals("tchinese", steam("zh-HK"))
}
@Test fun everyAppLanguageButHindiHasSteamsOwn() {
com.droiddeck.launcher.core.AppLanguage.supported.forEach {
val steam = steam(it)
assertTrue("$it -> $steam", (steam == "english") == (it == "en" || it == "hi"))
}
assertEquals("brazilian", steam("pt-BR"))
assertEquals("portuguese", steam("pt-PT"))
assertEquals("latam", steam("es-419"))
assertEquals("indonesian", steam("id"))
assertEquals("malay", steam("ms"))
}
@Test fun chineseFollowsTheScriptBeforeTheRegion() {
assertEquals("tchinese", steam("zh-Hant-CN"))
assertEquals("schinese", steam("zh-Hans-HK"))