mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
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.
This commit is contained in:
1 parent
1951d8bfde
commit
0b04678bdc
76 files changed
+2150
-919
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import com.droiddeck.launcher.R
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import org.junit.After
|
||||
@@ -30,15 +31,15 @@ class AppImageManagerTest {
|
||||
|
||||
@Test fun acceptsAnI386ImageForFex() = assertNull(AppImageManager.problem(image(3)))
|
||||
|
||||
@Test fun refusesOtherProcessors() = assertTrue(AppImageManager.problem(image(40))!!.contains("neither"))
|
||||
@Test fun refusesOtherProcessors() = assertTrue(AppImageManager.problem(image(40))!!.text == R.string.appimg_wrong_arch)
|
||||
|
||||
@Test fun refusesTypeOne() = assertTrue(AppImageManager.problem(image(183, type = 1))!!.contains("type 2"))
|
||||
@Test fun refusesTypeOne() = assertTrue(AppImageManager.problem(image(183, type = 1))!!.text == R.string.appimg_wrong_type)
|
||||
|
||||
@Test fun refusesAPlainProgram() = assertTrue(AppImageManager.problem(image(183, magic = false))!!.contains("not an AppImage"))
|
||||
@Test fun refusesAPlainProgram() = assertTrue(AppImageManager.problem(image(183, magic = false))!!.text == R.string.appimg_not_appimage)
|
||||
|
||||
@Test fun refusesSomethingElse() {
|
||||
val f = File(dir, "notes.AppImage").apply { writeText("hello, this is not a program at all") }
|
||||
assertTrue(AppImageManager.problem(f)!!.contains("not an AppImage"))
|
||||
assertTrue(AppImageManager.problem(f)!!.text == R.string.appimg_not_linux)
|
||||
}
|
||||
|
||||
@Test fun idsAreTidyAndUnique() {
|
||||
|
||||
@@ -53,7 +53,7 @@ class DeckyPluginInstallTest {
|
||||
try {
|
||||
DeckyPluginInstall.activate(plugin(temporary.newFolder(), "Unifideck", "Unifideck"), plugins, "Unifideck", settings, ".test")
|
||||
fail("Expected conflicting identity to fail")
|
||||
} catch (_: IllegalArgumentException) {}
|
||||
} catch (_: DeckyPluginInstall.Failure) {}
|
||||
assertEquals("{}", settings.readText())
|
||||
assertEquals("Other", JSONObject(File(plugins, "Unifideck/plugin.json").readText()).getString("name"))
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ class RuntimeRemovalTest {
|
||||
|
||||
@Test fun reservationBlocksPlayAndInstallBeforeTheWorkerStartsAndFollowersSeeProgress() {
|
||||
val root = runtime()
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(root)!!
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, root)!!
|
||||
assertTrue(LinuxRuntimeInstaller.isBusy())
|
||||
assertTrue(LinuxRuntimeInstaller.isRemoving())
|
||||
assertFalse(LinuxRuntimeInstaller.isInstalling())
|
||||
assertFalse(LinuxRuntime.isInstalled(null))
|
||||
assertNull(LinuxRuntimeInstaller.beginUninstall(root))
|
||||
assertNull(LinuxRuntimeInstaller.beginUninstall(null, root))
|
||||
assertFalse(LinuxRuntimeInstaller.install(null, null, null))
|
||||
val entered = CountDownLatch(1)
|
||||
val release = CountDownLatch(1)
|
||||
@@ -94,10 +94,10 @@ class RuntimeRemovalTest {
|
||||
try {
|
||||
assertTrue(entered.await(5, TimeUnit.SECONDS))
|
||||
val following = CountDownLatch(1)
|
||||
val stages = mutableListOf<String>()
|
||||
val percents = mutableListOf<Int>()
|
||||
val followerResult = AtomicReference<Boolean>()
|
||||
val follower = Thread {
|
||||
followerResult.set(LinuxRuntimeInstaller.attach { stage, _ -> stages.add(stage); following.countDown() })
|
||||
followerResult.set(LinuxRuntimeInstaller.attach { _, percent -> percents.add(percent); following.countDown() })
|
||||
}
|
||||
follower.start()
|
||||
assertTrue(following.await(5, TimeUnit.SECONDS))
|
||||
@@ -106,7 +106,8 @@ class RuntimeRemovalTest {
|
||||
follower.join(5000)
|
||||
assertEquals(true, result.get())
|
||||
assertEquals(true, followerResult.get())
|
||||
assertEquals("Linux runtime removed", stages.last())
|
||||
// The last stage is "Linux runtime removed", the only one reported at 100.
|
||||
assertEquals(100, percents.last())
|
||||
assertFalse(root.exists())
|
||||
assertFalse(File(dir, "linuxfs.removing").exists())
|
||||
assertFalse(LinuxRuntimeInstaller.isBusy())
|
||||
@@ -120,7 +121,7 @@ class RuntimeRemovalTest {
|
||||
val tree = File(dir, name).apply { mkdirs() }
|
||||
File(tree, "game").writeText("staged")
|
||||
}
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(File(dir, "linuxfs"))!!
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, File(dir, "linuxfs"))!!
|
||||
assertTrue(removal.run(null))
|
||||
assertTrue(dir.listFiles()!!.isEmpty())
|
||||
}
|
||||
@@ -128,9 +129,11 @@ class RuntimeRemovalTest {
|
||||
@Test fun aPartialRemovalStaysQuarantinedAndRetryable() {
|
||||
val root = runtime()
|
||||
try {
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(root)!!
|
||||
assertFalse(removal.run { stage, _ ->
|
||||
if (stage.contains("entries"))
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, root)!!
|
||||
// The first stage names the removal, the second counts its first entry.
|
||||
var stages = 0
|
||||
assertFalse(removal.run { _, _ ->
|
||||
if (++stages == 2)
|
||||
Files.setPosixFilePermissions(dir.toPath(), PosixFilePermissions.fromString("r-xr-xr-x"))
|
||||
})
|
||||
assertFalse(root.exists())
|
||||
@@ -138,7 +141,7 @@ class RuntimeRemovalTest {
|
||||
assertFalse(LinuxRuntimeInstaller.isBusy())
|
||||
assertNotNull(LinuxRuntimeInstaller.removalError())
|
||||
} finally { dir.setWritable(true) }
|
||||
assertTrue(LinuxRuntimeInstaller.beginUninstall(root)!!.run(null))
|
||||
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
|
||||
assertFalse(File(dir, "linuxfs.removing").exists())
|
||||
}
|
||||
|
||||
@@ -146,15 +149,15 @@ class RuntimeRemovalTest {
|
||||
val root = runtime()
|
||||
Files.setPosixFilePermissions(dir.toPath(), PosixFilePermissions.fromString("r-xr-xr-x"))
|
||||
try {
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(root)!!
|
||||
val stages = mutableListOf<String>()
|
||||
assertFalse(removal.run { stage, _ -> stages.add(stage) })
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, root)!!
|
||||
val percents = mutableListOf<Int>()
|
||||
assertFalse(removal.run { _, percent -> percents.add(percent) })
|
||||
assertTrue(root.exists())
|
||||
assertFalse(LinuxRuntimeInstaller.isBusy())
|
||||
assertTrue(LinuxRuntimeInstaller.removalError()!!.contains("Retry removal"))
|
||||
assertFalse(stages.contains("Linux runtime removed"))
|
||||
assertNotNull(LinuxRuntimeInstaller.removalError())
|
||||
assertFalse(percents.contains(100))
|
||||
} finally { dir.setWritable(true) }
|
||||
assertTrue(LinuxRuntimeInstaller.beginUninstall(root)!!.run(null))
|
||||
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
|
||||
assertNull(LinuxRuntimeInstaller.removalError())
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class RuntimeRemovalUiTest {
|
||||
}
|
||||
|
||||
@Test fun directSessionLaunchDuringRemovalFinishesWithoutStartingTheGuest() {
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(File(dir, "linuxfs"))!!
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, File(dir, "linuxfs"))!!
|
||||
try {
|
||||
val activity = Robolectric.buildActivity(SessionActivity::class.java).create()
|
||||
assertTrue(activity.get().isFinishing)
|
||||
|
||||
Reference in new issue
Block a user