Satellite tracker and pass predictor for Android, inspired by Gpredict
Kotlin amsatcelestrakgpsham-radiohamlibhamradiokotlinnasaradiosatellitesatellite-datasatellite-positionsatellite-predictionsatellitessatnogssdrspacespacexstarlink
Localized AMSAT status screen for Chinese (#245)
atsunatsu9cac33dae7e2
diff --git a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.ktindex 9edc85a3..979276f2 100644--- a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt+++ b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt@@ -92,11 +92,10 @@ class AmSatRepository(private val remoteSource: IRemoteSource) : IAmSatRepositor/** Build one SatStatus (5 days x 12 slots) per catalog satellite, slotting reports by age. */private fun buildStatuses(names: List<String>, reports: List<ApiReport>, nowSec: Long): List<SatStatus> {val byName = reports.groupBy { it.name }- val monthAbbr = arrayOf("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")val utc = Calendar.getInstance(TimeZone.getTimeZone("UTC"))val labels = (0 until 3).map { d ->utc.timeInMillis = (nowSec - d * 86400L) * 1000- "${monthAbbr[utc.get(Calendar.MONTH)]} ${utc.get(Calendar.DAY_OF_MONTH)}"+ formatDayLabel(utc)}return names.map { name ->val slots = (0 until 36).map { slotIdx ->@@ -121,6 +120,15 @@ class AmSatRepository(private val remoteSource: IRemoteSource) : IAmSatRepositor}}+ private fun formatDayLabel(calendar: Calendar): String {+ return if (Locale.getDefault().language == Locale.CHINESE.language) {+ "${calendar.get(Calendar.MONTH) + 1}月${calendar.get(Calendar.DAY_OF_MONTH)}日"+ } else {+ val monthAbbr = arrayOf("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")+ "${monthAbbr[calendar.get(Calendar.MONTH)]} ${calendar.get(Calendar.DAY_OF_MONTH)}"+ }+ }+private fun toSatReport(r: ApiReport): SatReport {val cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"))cal.timeInMillis = r.reportedTimeUtcSec * 1000diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xmlindex 8d1f608e..bc7536e3 100644--- a/core/presentation/src/main/res/values-zh/strings.xml+++ b/core/presentation/src/main/res/values-zh/strings.xml@@ -12,6 +12,25 @@<string name="nav_map">地图</string><string name="nav_prefs">设置</string>+ <!-- AMSAT Status screen -->+ <string name="nav_amsat">AMSAT</string>+ <string name="amsat_title">AMSAT 卫星状态</string>+ <string name="amsat_refresh">刷新</string>+ <string name="amsat_retry">重试</string>+ <string name="amsat_updated">更新于:</string>+ <string name="amsat_active">活跃</string>+ <string name="amsat_tlm">遥测/信标</string>+ <string name="amsat_not_heard">未听到</string>+ <string name="amsat_conflict">冲突</string>+ <string name="amsat_name">名称</string>+ <string name="amsat_load_failed">加载失败 - 检查网络后重试</string>+ <string name="amsat_no_reports">此时间段无报告</string>+ <string name="amsat_close">关闭</string>+ <string name="amsat_status_heard">已听到</string>+ <string name="amsat_status_tlm_only">仅遥测</string>+ <string name="amsat_status_not_heard">未听到</string>+ <string name="amsat_status_crew_active">乘组活跃</string>+<!-- Satellites screen --><string name="sat_type_hint">模式:%s</string><string name="sat_type_title">选择模式</string>diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xmlindex 471f187b..24d1ca25 100644--- a/core/presentation/src/main/res/values/strings.xml+++ b/core/presentation/src/main/res/values/strings.xml@@ -79,6 +79,10 @@<string name="amsat_load_failed">Load failed - check network and retry</string><string name="amsat_no_reports">No reports for this period</string><string name="amsat_close">Close</string>+ <string name="amsat_status_heard">Heard</string>+ <string name="amsat_status_tlm_only">Telemetry Only</string>+ <string name="amsat_status_not_heard">Not Heard</string>+ <string name="amsat_status_crew_active">Crew Active</string><!-- Radar screen --><string name="radar_back">Back</string>diff --git a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.ktindex ed7d71d4..5f9fc4d7 100644--- a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt+++ b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt@@ -55,6 +55,7 @@ import com.rtbishop.look4sat.core.presentation.InfoDialogimport com.rtbishop.look4sat.core.presentation.Rimport com.rtbishop.look4sat.core.presentation.layoutPaddingimport java.util.Calendar+import java.util.Locale/** Fixed width per day tile — tablet-safe; name column absorbs remaining space. */private val TILE_WIDTH: Dp = 64.dp@@ -77,6 +78,19 @@ private fun statusColorOf(statusText: String): Color {}}+/** Localize AMSAT API status text for the current locale; falls back to the raw text. */+@Composable+private fun statusTextOf(statusText: String): String {+ if (Locale.getDefault().language != Locale.CHINESE.language) return statusText+ return when (statusText.lowercase()) {+ "heard" -> stringResource(R.string.amsat_status_heard)+ "telemetry only" -> stringResource(R.string.amsat_status_tlm_only)+ "not heard" -> stringResource(R.string.amsat_status_not_heard)+ "crew active" -> stringResource(R.string.amsat_status_crew_active)+ else -> statusText+ }+}+@Composablefun SatStatusDestination() {val context = LocalContext.current@@ -296,7 +310,7 @@ private fun ReportDialog(statusName: String, day: SatDay, reports: Map<String, S.background(statusColorOf(report.statusText)))Spacer(modifier = Modifier.width(6.dp))- Text(text = report.statusText, fontSize = 14.sp, fontWeight = FontWeight.Bold)+ Text(text = statusTextOf(report.statusText), fontSize = 14.sp, fontWeight = FontWeight.Bold)}Text(text = "${report.call} ${report.dateUtc} ${report.timeUtc}" +@@ -318,10 +332,14 @@ private fun formatFetchedAt(utcMs: Long): String {val cal = Calendar.getInstance()cal.timeInMillis = utcMsval day = cal.get(Calendar.DAY_OF_MONTH)- val month = MONTH_ABBR[cal.get(Calendar.MONTH)]+ val monthIndex = cal.get(Calendar.MONTH)val year = cal.get(Calendar.YEAR)val hh = cal.get(Calendar.HOUR_OF_DAY).toString().padStart(2, '0')val mm = cal.get(Calendar.MINUTE).toString().padStart(2, '0')val ss = cal.get(Calendar.SECOND).toString().padStart(2, '0')- return "$day$month $year - $hh:$mm:$ss"+ return if (Locale.getDefault().language == Locale.CHINESE.language) {+ "${year}年${monthIndex + 1}月${day}日 - $hh:$mm:$ss"+ } else {+ "$day${MONTH_ABBR[monthIndex]} $year - $hh:$mm:$ss"+ }}