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.kt index 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, reports: List, nowSec: Long): List { 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 * 1000 diff --git a/core/presentation/src/main/res/values-zh/strings.xml b/core/presentation/src/main/res/values-zh/strings.xml index 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 @@ 地图 设置 + + AMSAT + AMSAT 卫星状态 + 刷新 + 重试 + 更新于: + 活跃 + 遥测/信标 + 未听到 + 冲突 + 名称 + 加载失败 - 检查网络后重试 + 此时间段无报告 + 关闭 + 已听到 + 仅遥测 + 未听到 + 乘组活跃 + 模式:%s 选择模式 diff --git a/core/presentation/src/main/res/values/strings.xml b/core/presentation/src/main/res/values/strings.xml index 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 @@ Load failed - check network and retry No reports for this period Close + Heard + Telemetry Only + Not Heard + Crew Active Back 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.kt index 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.InfoDialog import com.rtbishop.look4sat.core.presentation.R import com.rtbishop.look4sat.core.presentation.layoutPadding import 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 + } +} + @Composable fun SatStatusDestination() { val context = LocalContext.current @@ -296,7 +310,7 @@ private fun ReportDialog(statusName: String, day: SatDay, reports: Map