featL add localization for various UI strings and error messages
This commit is contained in:
@@ -12,11 +12,11 @@ struct ChangePasswordView: View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section {
|
||||
SecureField("Текущий пароль", text: $currentPassword)
|
||||
SecureField("current_password", text: $currentPassword)
|
||||
.textContentType(.password)
|
||||
SecureField("Новый пароль", text: $newPassword)
|
||||
SecureField("new_password", text: $newPassword)
|
||||
.textContentType(.newPassword)
|
||||
SecureField("Подтвердите новый пароль", text: $confirmPassword)
|
||||
SecureField("confirm_new_password", text: $confirmPassword)
|
||||
.textContentType(.newPassword)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ struct ChangePasswordView: View {
|
||||
}
|
||||
|
||||
Section {
|
||||
Button("Сохранить") {
|
||||
Button("save_button") {
|
||||
Task {
|
||||
let success = await viewModel.changePassword(current: currentPassword, new: newPassword)
|
||||
if success { dismiss() }
|
||||
@@ -43,11 +43,11 @@ struct ChangePasswordView: View {
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Сменить пароль")
|
||||
.navigationTitle("change_password_title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
Button("Отмена") { dismiss() }
|
||||
Button("cancel") { dismiss() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ struct SessionsView: View {
|
||||
.font(.body)
|
||||
.lineLimit(1)
|
||||
if session.isCurrent {
|
||||
Text("Текущая")
|
||||
Text("current_session")
|
||||
.font(.caption)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
@@ -26,7 +26,7 @@ struct SessionsView: View {
|
||||
Text(session.ipAddress)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
Text("Создана: \(session.createdAt.formatted(date: .abbreviated, time: .shortened))")
|
||||
Text("session_created \(session.createdAt.formatted(date: .abbreviated, time: .shortened))")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
@@ -35,17 +35,17 @@ struct SessionsView: View {
|
||||
Button(role: .destructive) {
|
||||
Task { await viewModel.deleteSession(session) }
|
||||
} label: {
|
||||
Label("Удалить", systemImage: "trash")
|
||||
Label("delete_button", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Активные сессии")
|
||||
.navigationTitle("active_sessions_title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("Готово") { dismiss() }
|
||||
Button("done_button") { dismiss() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,14 @@ struct SettingsView: View {
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section("Аккаунт") {
|
||||
Section("account_section") {
|
||||
if let user = authViewModel.currentUser {
|
||||
LabeledContent("Email", value: user.email)
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Button("Сменить пароль") {
|
||||
Button("change_password") {
|
||||
showChangePassword = true
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ struct SettingsView: View {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
Label("Push-уведомления", systemImage: "bell.badge")
|
||||
Label("push_notifications", systemImage: "bell.badge")
|
||||
.foregroundStyle(.primary)
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ struct SettingsView: View {
|
||||
showSessions = true
|
||||
} label: {
|
||||
HStack {
|
||||
Text("Активные сессии")
|
||||
Text("active_sessions")
|
||||
Spacer()
|
||||
if !viewModel.sessions.isEmpty {
|
||||
Text("(\(viewModel.sessions.count))")
|
||||
@@ -52,20 +52,20 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
Section {
|
||||
Button("Выйти из аккаунта", role: .destructive) {
|
||||
Button("logout_button", role: .destructive) {
|
||||
Task { await authViewModel.logout() }
|
||||
}
|
||||
|
||||
Button("Выйти на всех устройствах", role: .destructive) {
|
||||
Button("logout_all_button", role: .destructive) {
|
||||
showLogoutAllConfirm = true
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Настройки")
|
||||
.navigationTitle("settings_title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("Готово") { dismiss() }
|
||||
Button("done_button") { dismiss() }
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showChangePassword) {
|
||||
@@ -76,11 +76,11 @@ struct SettingsView: View {
|
||||
.environmentObject(viewModel)
|
||||
}
|
||||
.confirmationDialog(
|
||||
"Выйти на всех устройствах?",
|
||||
"logout_all_confirm",
|
||||
isPresented: $showLogoutAllConfirm,
|
||||
titleVisibility: .visible
|
||||
) {
|
||||
Button("Выйти везде", role: .destructive) {
|
||||
Button("logout_all_action", role: .destructive) {
|
||||
Task {
|
||||
do {
|
||||
_ = try await NotificationsAPIService.shared.logoutAll()
|
||||
@@ -90,10 +90,10 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
Button("Отмена", role: .cancel) {}
|
||||
Button("cancel", role: .cancel) {}
|
||||
}
|
||||
.alert(
|
||||
"Ошибка",
|
||||
"error_title",
|
||||
isPresented: Binding(
|
||||
get: { logoutAllError != nil },
|
||||
set: { if !$0 { logoutAllError = nil } }
|
||||
|
||||
Reference in New Issue
Block a user