Translate the remaining hard-coded interface texts (#129)

* Translate the interface texts that stage 9 left in English

The GUI tab checkboxes, the file chooser and dropdown placeholders, the
profile dialog's Apply, the settings notice's OK, the chat clear button,
the selected-station map button and "all", six column titles, the monitor
window's title and heading, and the refusal and hint texts of the profiles,
beacon and notification tab states now come from the translation files.

Column titles go through CurrentStrings in a lambda like the existing ones,
so the id stays untranslated and the stored layout keeps its keys. The tab
states read CurrentStrings as StatusIndicatorState already does. The
English values are unchanged, so the screen tests still find every control
by its old label; a new test switches to German and checks one sample per
path: a composed label, a column title and a tab-state refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Translate the settings notices, profile labels and alert button too

Wires the settings.spot* and settings.write* keys that existed but were
never used, translates the settings window title and its notice titles,
the profile tab's "unknown", "Copy of" and database-mode labels, and lets
the shared alert use alert.ok instead of a literal. The German for
messages.qsoOfTheOther becomes "Fremd-QSOs", the word the menu already uses.

"Copy of" is only the suggested display name; the profile id is derived
from the entered name once at creation and stored, so a later language
switch does not touch it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Rsclub2_2andClaude Opus 5.5 authored and GitHub committed 2026-10-16 11:11:39 +02:00
1 parent a9d8c013ef
commit c9b838e946
21 files changed
+278 -82

No files matched your search

@@ -0,0 +1,121 @@
package kst4contest.view.i18n
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.runComposeUiTest
import kst4contest.model.ChatPreferences
import kst4contest.view.compose.SettingsContent
import kst4contest.view.compose.SettingsNotices
import kst4contest.view.compose.SettingsTab
import kst4contest.view.compose.StationColumns
import kst4contest.view.compose.tabs.BeaconTabState
import kst4contest.view.compose.tabs.GuiOptionsTab
import kst4contest.view.compose.tabs.GuiOptionsTabState
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
import java.nio.file.Path
import java.util.Locale
/**
* The texts that stayed English after stage 9 now follow the language as well.
*
* One sample from each of the three ways a text reaches the operator: a label read inside a
* composition, a column title built outside one, and a refusal produced by a tab state. All
* three have to switch, and each goes through a different door.
*/
@OptIn(ExperimentalTestApi::class)
class RemainingTextsFollowTheLanguageTest {
/* Never the no-argument ChatPreferences: it would touch the operator's real profile. */
@TempDir
lateinit var directory: Path
@Test
fun theMovedTextsAppearInGermanAfterTheSwitch() = runComposeUiTest {
var stored = "en"
val store = LanguageStore({ stored }, { stored = it }, Locale.UK)
val prefs = ChatPreferences(directory.resolve("preferences.xml"))
val state = GuiOptionsTabState(prefs, store)
val beacon = BeaconTabState(
prefs,
validateBeaconTemplate = {},
restartBeaconTimer = {},
mainCategoryName = "Microwave",
secondCategoryName = "144/432 MHz",
)
val score = StationColumns.all(
tropoOf = { "" },
priorityScoreOf = { 0.0 },
formatBand = { _, _, _ -> "" },
).single { it.id == "score" }
setContent {
CompositionLocalProvider(LocalStrings provides store.strings) {
GuiOptionsTab(state)
}
}
waitForIdle()
onNodeWithText("Start in the evening design").assertExists()
assertEquals("Score", score.title())
try {
runOnIdle { store.use("de") }
waitForIdle()
onNodeWithText("Im Abenddesign starten").assertExists()
onNodeWithText("Kein Filter").assertExists()
onNodeWithText("Ein gearbeitetes Großfeld markieren").assertExists()
assertEquals("Wertung", score.title(), "the column title stayed in the old language")
assertEquals(
"Einen ganzzahligen Bakenabstand von mindestens 1 Minute eingeben.",
beacon.commitBeaconInterval("0"),
"the refusal from the tab state stayed in the old language",
)
} finally {
// use() also sets the JVM-wide CurrentStrings; leave the next test the base language.
runOnIdle { store.use("en") }
}
}
/**
* The settings window's notice: its title is read in the composition, its message is
* produced outside one by the save action -- the same split as above, one window further.
*/
@Test
fun theSettingsNoticeFollowsTheLanguage() = runComposeUiTest {
var stored = "en"
val store = LanguageStore({ stored }, { stored = it }, Locale.UK)
val notices = SettingsNotices()
setContent {
CompositionLocalProvider(LocalStrings provides store.strings) {
SettingsContent(
tabs = listOf(SettingsTab("Tab") {}),
notices = notices,
buttons = {},
close = {},
)
}
}
try {
runOnIdle {
store.use("de")
notices.problem(CurrentStrings.get().settingsWriteFailed)
}
waitForIdle()
onNodeWithText("Einstellungen").assertExists()
onNodeWithText(
"Die Konfigurationsdatei konnte nicht geschrieben werden. " +
"Die Einstellungen bleiben für diese Sitzung aktiv.",
).assertExists()
} finally {
runOnIdle { store.use("en") }
}
}
}