mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Language setting and translations: Spanish, Japanese, Korean, Chinese; Steam follows it (#187) (#284)
* l10n: move hard-coded UI text into string resources (#212) About 650 user-facing strings were written in Kotlin and Java, so no translation could reach them and the UI stayed half English in every language. They now live in values/strings.xml. - Dialogs, menus, status lines, toasts and errors shown to the user go through getString/stringResource. - Code that matched on English text now uses IDs: installer and loading stages, Decky stages, storage labels and the Back button's order labels. - Choice lists (upscalers, FPS limits, textures, themes, presets) carry @StringRes labels instead of English. - Robolectric tests read the app's resources (includeAndroidResources). - Six strings nothing used any more are dropped. Existing translations are untouched; the new strings show in English until they are translated. * Layouts: fit longer text in other languages, and small phones Found by screenshotting every page, tab and menu in each language on a phone, a tablet, a 640dp phone and a foldable. - Rail labels shrink to fit instead of being cut off (FitText). - Tab rows tighten when they overflow and scroll the chosen tab into view. - Menus fade over a down arrow when more entries are below, and open scrolled to the current choice. - On a small phone the desktop card's button moves under its title, emulator tiles go two across, the GPU support verdict wraps and the Updates page stacks the channels under the status. * l10n: translate every string into Spanish, Japanese, Korean and Chinese (#187) Simplified Chinese, Traditional Chinese (Taiwan) and Traditional Chinese (Hong Kong, reviewed for Hong Kong wording) are complete, as are Spanish, Japanese and Korean: no missing keys and no placeholder mismatches. * Language setting: follow the system, or a language picked in Setup; Steam uses it too (#187) - Setup -> Launcher starts with a Language row: "System default (...)" and each language by its own name. With nothing picked the app follows the system language; a pick applies at once and stays until System default is picked again. - Steam keeps its language in ~/.steam/registry.vdf under both Valve/Steam/language and Valve/Steamsteamglobal/language. Before each start of the client the guest helper droiddeck-steam-language writes both (and exportedsettings.json), and the client gets -language. SteamLanguage maps the app's language to Steam's names: english, spanish/latam, japanese, koreana, schinese, tchinese. * l10n: translate the strings main added since, and Chinese review fixes - Translate the 32 strings added on main since (Windows components, device details, Force SSBS, native Steam sleep) into all six languages. - zh-CN: busy labels say what is in progress again (正在取消, 正在导出 ...), as the other languages do. - zh-CN: "set up" is 配置, as Setup is; 设置 stays for Settings. - zh-TW: proton_compatible_note says 前綴 rather than "prefix".
This commit is contained in:
1 parent
50f50b16e0
commit
1bc23ac169
33 files changed
+8292
-781
No files matched your search
@@ -45,6 +45,7 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-clipboard" to "usr/local/bin/droiddeck-clipboard",
|
||||
"usr/local/bin/droiddeck-steam-install" to "usr/local/bin/droiddeck-steam-install",
|
||||
"usr/local/bin/droiddeck-steam-ui-scale" to "usr/local/bin/droiddeck-steam-ui-scale",
|
||||
"usr/local/bin/droiddeck-steam-language" to "usr/local/bin/droiddeck-steam-language",
|
||||
"usr/local/bin/droiddeck-steam-library" to "usr/local/bin/droiddeck-steam-library",
|
||||
"usr/local/bin/droiddeck-seed-redists" to "usr/local/bin/droiddeck-seed-redists",
|
||||
"usr/local/bin/droiddeck-proton-extra" to "usr/local/bin/droiddeck-proton-extra",
|
||||
|
||||
@@ -60,6 +60,9 @@ import java.util.UUID
|
||||
* The activity comes and goes on top of this; see [com.droiddeck.launcher.wayland.CompositorHost].
|
||||
*/
|
||||
class SessionService : Service() {
|
||||
override fun attachBaseContext(newBase: android.content.Context) =
|
||||
super.attachBaseContext(com.droiddeck.launcher.core.AppLanguage.wrap(newBase))
|
||||
|
||||
private val components = java.util.concurrent.CopyOnWriteArrayList<SessionPart>()
|
||||
/** The Steam Deck controller's sysfs binds (SteamDeckPad), when this session has one. */
|
||||
private var deckBinds: List<String> = emptyList()
|
||||
@@ -554,6 +557,12 @@ class SessionService : Service() {
|
||||
guest.add("PATH=/usr/local/bin:/usr/bin:/bin")
|
||||
guest.add("TERM=xterm-256color")
|
||||
guest.add("LANG=C.UTF-8")
|
||||
// Steam's interface language: the app's (Setup's choice, or the system's). The system's
|
||||
// region decides between Spain's and Latin American Spanish, which the app has one of.
|
||||
guest.add("BL_STEAM_LANGUAGE=" + SteamLanguage.forLocale(
|
||||
com.droiddeck.launcher.core.AppLanguage.effective(this),
|
||||
com.droiddeck.launcher.core.AppLanguage.system(this).country,
|
||||
))
|
||||
// Without this the session is UTC: the client's clock, its logs and every timestamp in a
|
||||
// session bundle sit hours off the device's. Bannerlator carries the same line.
|
||||
guest.add("TZ=" + java.util.TimeZone.getDefault().id)
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Steam's name for a language: the API language codes the client and the Steamworks API use
|
||||
* ("english", "schinese", "koreana"...), for every language Steam's interface comes in.
|
||||
*/
|
||||
object SteamLanguage {
|
||||
const val DEFAULT = "english"
|
||||
|
||||
/** Every language the Steam client's interface is offered in. */
|
||||
val all: Set<String> = setOf(
|
||||
"arabic", "bulgarian", "schinese", "tchinese", "czech", "danish", "dutch", "english",
|
||||
"finnish", "french", "german", "greek", "hungarian", "indonesian", "italian", "japanese",
|
||||
"koreana", "norwegian", "polish", "portuguese", "brazilian", "romanian", "russian",
|
||||
"spanish", "latam", "swedish", "thai", "turkish", "ukrainian", "vietnamese", "malay",
|
||||
)
|
||||
|
||||
/** Spanish-speaking regions Steam serves with Latin American Spanish rather than Spain's. */
|
||||
private val latinAmerica = setOf(
|
||||
"419", "AR", "BO", "CL", "CO", "CR", "CU", "DO", "EC", "GT", "HN", "MX", "NI", "PA", "PE",
|
||||
"PR", "PY", "SV", "US", "UY", "VE",
|
||||
)
|
||||
|
||||
/**
|
||||
* Steam's language for [locale]. [region] stands in for the locale's own when it has none: the
|
||||
* app's Spanish carries no region, and a player in Mexico should get Latin American Spanish.
|
||||
*/
|
||||
fun forLocale(locale: Locale, region: String? = null): String {
|
||||
val country = locale.country.ifEmpty { region.orEmpty() }
|
||||
return when (locale.language) {
|
||||
"ar" -> "arabic"
|
||||
"bg" -> "bulgarian"
|
||||
"cs" -> "czech"
|
||||
"da" -> "danish"
|
||||
"nl" -> "dutch"
|
||||
"en" -> "english"
|
||||
"fi" -> "finnish"
|
||||
"fr" -> "french"
|
||||
"de" -> "german"
|
||||
"el" -> "greek"
|
||||
"hu" -> "hungarian"
|
||||
"id", "in" -> "indonesian"
|
||||
"it" -> "italian"
|
||||
"ms" -> "malay"
|
||||
"ja" -> "japanese"
|
||||
"ko" -> "koreana"
|
||||
"nb", "no", "nn" -> "norwegian"
|
||||
"pl" -> "polish"
|
||||
"pt" -> if (country == "BR") "brazilian" else "portuguese"
|
||||
"ro" -> "romanian"
|
||||
"ru" -> "russian"
|
||||
"es" -> if (country in latinAmerica) "latam" else "spanish"
|
||||
"sv" -> "swedish"
|
||||
"th" -> "thai"
|
||||
"tr" -> "turkish"
|
||||
"uk" -> "ukrainian"
|
||||
"vi" -> "vietnamese"
|
||||
"zh" -> when {
|
||||
locale.script == "Hant" -> "tchinese"
|
||||
locale.script == "Hans" -> "schinese"
|
||||
country == "TW" || country == "HK" || country == "MO" -> "tchinese"
|
||||
else -> "schinese"
|
||||
}
|
||||
else -> DEFAULT
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user