mycode/myApp/HaruDanim/Shared/Settings.swift
songyc macbook a6c040cd6a feat(i18n): 전체 UI 다국어 지원 (한국어·영어·일본어)
- 언어 설정 실적용: 변경 시 AppleLanguages 오버라이드 저장, 재시작 안내 footer
- 자동 추출되지 않던 일반 문자열(탭 이름, 픽커 라벨, 상태 뱃지, 포매터,
  삼항 문구, 심볼 카테고리 등)을 String(localized:)로 전환
- 위젯·워치 앱·컴플리케이션 타깃에 Localizable.xcstrings 신설
  (중복 리소스 방지 pbxproj 예외 추가), xcstringstool sync로 키 추출
- 4개 카탈로그 전체 키(고유 430개)에 en/ja 번역 주입
- 영어의 긴 횟수 단위("times")가 잘리지 않도록 모음 탭 셀 축소 허용
- 검증: -AppleLanguages "(en)"/"(ja)"로 모음 탭·설정 화면 확인

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013yKDMhuF39GVYy3FMcGHh7
2026-07-10 15:03:24 +09:00

122 lines
4.2 KiB
Swift

//
// Settings.swift
// Haru_Danim
//
// , (CLAUDE.md §6.6, §7)
//
import Foundation
enum SettingsKeys {
/// "light" | "dark"
static let theme = "settings.theme"
/// "ko" | "en" | "ja"
static let language = "settings.language"
/// Calendar.weekday (1= ... 7=). 2()
static let weekStartWeekday = "settings.weekStartWeekday"
/// . 0 (00:00)
static let dayStartMinutes = "settings.dayStartMinutes"
/// "latest"( ) | "earliest"( ). latest
static let liveActivityMode = "settings.liveActivityMode"
// Shared/Premium.swift PremiumGate.cacheKey (App Group defaults)
/// . 3
static let gridColumns = "settings.gridColumns"
/// () . 0 =
static let minSessionSeconds = "settings.minSessionSeconds"
/// ( 1~3). AppTab rawValue
static let visibleTabs = "settings.visibleTabs"
/// . GoalCardStyle rawValue ("perQuest" | "combined")
static let goalCardStyle = "settings.goalCardStyle"
}
/// ( )
enum GoalCardStyle: String, CaseIterable, Identifiable {
/// ( 3) //
case perQuest
/// // ()
case combined
var id: String { rawValue }
var label: String {
switch self {
case .perQuest: return String(localized: "다짐별로 각각")
case .combined: return String(localized: "전체 다짐 합산")
}
}
}
enum TabBarConfig {
/// : · · (+)
static let defaultVisibleTabs = "main,action,history"
static let maxVisible = 3
static let minVisible = 1
}
/// ()
enum MinSessionOption {
static let choices: [(seconds: Int, label: String)] = [
(0, String(localized: "사용 안 함")),
(3, String(localized: "3초")),
(5, String(localized: "5초")),
(10, String(localized: "10초")),
(30, String(localized: "30초")),
(60, String(localized: "1분")),
]
}
enum LiveActivityMode: String, CaseIterable, Identifiable {
case latest
case earliest
var id: String { rawValue }
var label: String {
switch self {
case .latest: return String(localized: "가장 나중에 시작한 행동")
case .earliest: return String(localized: "가장 먼저 시작한 행동")
}
}
}
enum AppLanguage: String, CaseIterable, Identifiable {
case ko, en, ja
var id: String { rawValue }
var label: String {
switch self {
case .ko: return "한국어"
case .en: return "English"
case .ja: return "日本語"
}
}
}
// (FreeLimits) Shared/Premium.swift (· )
///
struct TrackingSettings {
var weekStartWeekday: Int
var dayStartMinutes: Int
static func current() -> TrackingSettings {
// App Group (· ), standard
let group = AppGroup.defaults
let standard = UserDefaults.standard
func intValue(_ key: String, default defaultValue: Int) -> Int {
(group.object(forKey: key) ?? standard.object(forKey: key)) as? Int ?? defaultValue
}
return TrackingSettings(
weekStartWeekday: intValue(SettingsKeys.weekStartWeekday, default: 2),
dayStartMinutes: intValue(SettingsKeys.dayStartMinutes, default: 0)
)
}
var calendar: Calendar {
var cal = Calendar.current
cal.firstWeekday = weekStartWeekday
return cal
}
}