featL add localization for various UI strings and error messages
This commit is contained in:
@@ -29,7 +29,7 @@ struct NotificationDetailView: View {
|
||||
Button {
|
||||
Task { await viewModel.markAsRead(notification) }
|
||||
} label: {
|
||||
Text("Отметить прочитанным")
|
||||
Text("mark_as_read")
|
||||
.font(.headline)
|
||||
.foregroundStyle(.red)
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -45,7 +45,7 @@ struct NotificationDetailView: View {
|
||||
}
|
||||
}
|
||||
.background(Color(.systemGroupedBackground))
|
||||
.navigationTitle("Подробности")
|
||||
.navigationTitle("details_section")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.task {
|
||||
await viewModel.markAsRead(notification)
|
||||
@@ -89,8 +89,8 @@ struct NotificationDetailView: View {
|
||||
|
||||
private var statusBadge: some View {
|
||||
let (text, color): (String, Color) = notification.isRead
|
||||
? ("Прочитано", .green)
|
||||
: ("Новое", .red)
|
||||
? (String(localized: "status_read"), .green)
|
||||
: (String(localized: "status_new"), .red)
|
||||
return Text(text)
|
||||
.font(.caption.bold())
|
||||
.foregroundStyle(color)
|
||||
@@ -104,7 +104,7 @@ struct NotificationDetailView: View {
|
||||
|
||||
private var detailsCard: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Label("Подробности", systemImage: "doc.text.fill")
|
||||
Label("details_section", systemImage: "doc.text.fill")
|
||||
.font(.subheadline.bold())
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
@@ -124,7 +124,7 @@ struct NotificationDetailView: View {
|
||||
|
||||
private func metadataCard(_ metadata: [String: String]) -> some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Label("Информация", systemImage: "info.circle.fill")
|
||||
Label("info_section", systemImage: "info.circle.fill")
|
||||
.font(.subheadline.bold())
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
@@ -170,17 +170,17 @@ struct NotificationDetailView: View {
|
||||
|
||||
private var statusCard: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Label("Статус", systemImage: "clock.fill")
|
||||
Label("status_section", systemImage: "clock.fill")
|
||||
.font(.subheadline.bold())
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
infoRow(icon: "paperplane.fill", label: "Канал", value: channelLabel)
|
||||
infoRow(icon: "paperplane.fill", label: String(localized: "channel_label"), value: channelLabel)
|
||||
Divider()
|
||||
infoRow(icon: "clock", label: "Получено", value: notification.createdAt.formatted(date: .abbreviated, time: .shortened))
|
||||
infoRow(icon: "clock", label: String(localized: "received_label"), value: notification.createdAt.formatted(date: .abbreviated, time: .shortened))
|
||||
if let readAt = notification.readAt {
|
||||
Divider()
|
||||
infoRow(icon: "checkmark.circle.fill", label: "Прочитано", value: readAt.formatted(date: .abbreviated, time: .shortened))
|
||||
infoRow(icon: "checkmark.circle.fill", label: String(localized: "read_at_label"), value: readAt.formatted(date: .abbreviated, time: .shortened))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ struct NotificationDetailView: View {
|
||||
|
||||
private var channelLabel: String {
|
||||
switch notification.channel {
|
||||
case .inApp: return "В приложении"
|
||||
case .inApp: return String(localized: "channel_in_app")
|
||||
case .push: return "Push"
|
||||
case .email: return "Email"
|
||||
}
|
||||
|
||||
@@ -20,27 +20,27 @@ struct NotificationsView: View {
|
||||
ProgressView()
|
||||
} else if let error = viewModel.error, viewModel.notifications.isEmpty {
|
||||
ContentUnavailableView(
|
||||
"Ошибка загрузки",
|
||||
"loading_error",
|
||||
systemImage: "exclamationmark.triangle",
|
||||
description: Text(error)
|
||||
)
|
||||
} else if viewModel.notifications.isEmpty {
|
||||
ContentUnavailableView(
|
||||
"Нет уведомлений",
|
||||
"no_notifications",
|
||||
systemImage: "bell.slash",
|
||||
description: Text("Новые уведомления появятся здесь")
|
||||
description: Text("no_notifications_description")
|
||||
)
|
||||
} else {
|
||||
notificationsList
|
||||
}
|
||||
}
|
||||
.background(Color(.systemGroupedBackground))
|
||||
.navigationTitle("Уведомления")
|
||||
.navigationTitle("notifications_title")
|
||||
.toolbar {
|
||||
#if DEBUG
|
||||
if PreviewData.isPreviewMode {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
Text("ДЕМО")
|
||||
Text("demo_badge")
|
||||
.font(.caption2.bold())
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 8)
|
||||
@@ -80,7 +80,7 @@ struct NotificationsView: View {
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 0) {
|
||||
if !unreadNotifications.isEmpty {
|
||||
sectionHeader("Активные")
|
||||
sectionHeader(String(localized: "notifications_active"))
|
||||
ForEach(unreadNotifications) { notification in
|
||||
NavigationLink(destination: NotificationDetailView(notification: notification, viewModel: viewModel)) {
|
||||
ActiveNotificationCard(notification: notification)
|
||||
@@ -97,7 +97,7 @@ struct NotificationsView: View {
|
||||
}
|
||||
|
||||
if !readNotifications.isEmpty {
|
||||
sectionHeader("Завершённые")
|
||||
sectionHeader(String(localized: "notifications_completed"))
|
||||
ForEach(readNotifications) { notification in
|
||||
NavigationLink(destination: NotificationDetailView(notification: notification, viewModel: viewModel)) {
|
||||
ResolvedNotificationCard(notification: notification)
|
||||
@@ -172,7 +172,7 @@ struct ActiveNotificationCard: View {
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Открыть")
|
||||
Text("open_button")
|
||||
.font(.subheadline.bold())
|
||||
.foregroundStyle(Color.red)
|
||||
.padding(.horizontal, 32)
|
||||
@@ -238,7 +238,7 @@ struct ResolvedNotificationCard: View {
|
||||
Image(systemName: "checkmark")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.green)
|
||||
Text("прочитано \(readAt.formatted(date: .abbreviated, time: .shortened))")
|
||||
Text("notification_read_at \(readAt.formatted(date: .abbreviated, time: .shortened))")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user