From 47746690d6a63a75d6a9fc25a329688daca28605 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Sun, 5 Oct 2025 06:28:29 +0300 Subject: [PATCH] translate burger menu --- yobble.xcodeproj/project.pbxproj | 2 +- yobble/Resources/Localizable.xcstrings | 96 ++++++++++++++------ yobble/Views/Tab/CustomTabBar.swift | 8 +- yobble/Views/Tab/Settings/FAQView.swift | 47 ++++++++++ yobble/Views/Tab/Settings/SettingsView.swift | 2 +- yobble/Views/Tab/SideMenuView.swift | 40 +++++--- 6 files changed, 149 insertions(+), 46 deletions(-) create mode 100644 yobble/Views/Tab/Settings/FAQView.swift diff --git a/yobble.xcodeproj/project.pbxproj b/yobble.xcodeproj/project.pbxproj index 2c8a383..6c725f5 100644 --- a/yobble.xcodeproj/project.pbxproj +++ b/yobble.xcodeproj/project.pbxproj @@ -187,7 +187,7 @@ }; }; buildConfigurationList = 1A6D61C72E7CD03E00B9F736 /* Build configuration list for PBXProject "yobble" */; - developmentRegion = en; + developmentRegion = ru; hasScannedForEncodings = 0; knownRegions = ( en, diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index e634ec1..552fcf8 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -1,5 +1,5 @@ { - "sourceLanguage" : "en", + "sourceLanguage" : "ru", "strings" : { "@%@" : { @@ -12,34 +12,15 @@ }, "CATEGORY" : { + }, + "Fun Fest" : { + "comment" : "Fun Fest" }, "Hello, world!" : { }, "loading_placeholder" : { - }, - "LoginView_button_login" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "ебите меня четверо" - } - } - } - }, - "ok" : { - "extractionState" : "stale", - "localizations" : { - "ru" : { - "stringUnit" : { - "state" : "translated", - "value" : "55454545" - } - } - } }, "OK" : { @@ -76,6 +57,9 @@ }, "Выйти из аккаунта" : { + }, + "Где найти сохранённые черновики?" : { + "comment" : "FAQ question: drafts" }, "Данные" : { @@ -107,8 +91,8 @@ "Заглушка: Хранилище данных" : { }, - "Заглушка: Частые вопросы" : { - + "Заказы" : { + "comment" : "Orders" }, "Закрыть" : { "comment" : "Закрыть" @@ -124,6 +108,27 @@ }, "Инвайт-код (необязательно)" : { "comment" : "Инвайт-код" + }, + "История" : { + "comment" : "History" + }, + "Как сбросить пароль?" : { + "comment" : "FAQ question: reset password" + }, + "Как связаться с поддержкой?" : { + "comment" : "FAQ question: support" + }, + "Корзина" : { + "comment" : "Cart" + }, + "Кошелёк" : { + "comment" : "Wallet" + }, + "Лента" : { + + }, + "Лицо" : { + }, "Логин" : { "comment" : "Логин" @@ -133,12 +138,27 @@ }, "Логин уже занят." : { + }, + "Люди, которых вы можете знать" : { + "comment" : "People You May Like" + }, + "Мини-приложения" : { + "comment" : "Applets" + }, + "Мои загрузки" : { + "comment" : "My Downloads" + }, + "Мои комментарии" : { + "comment" : "My Comments" }, "Мой профиль" : { + }, + "Напишите нам через форму обратной связи в разделе \"Поддержка\"." : { + "comment" : "FAQ answer: support" }, "Настройки" : { - + "comment" : "Settings" }, "Не удалось обработать ответ сервера." : { @@ -209,11 +229,17 @@ "Пароль должен быть от 8 до 128 символов" : { "comment" : "Пароль должен быть от 6 до 32 символов" }, + "Перейдите в раздел \"Настройки > Сменить пароль\" и следуйте инструкциям." : { + "comment" : "FAQ answer: reset password" + }, "Поддержка" : { }, "Подтверждение пароля" : { "comment" : "Подтверждение пароля" + }, + "Поиск" : { + }, "Приглашение достигло лимита использования." : { @@ -259,6 +285,9 @@ }, "Сервер не отвечает. Попробуйте позже." : { + }, + "Сканировать" : { + "comment" : "Scan" }, "Слишком много запросов." : { @@ -271,9 +300,24 @@ }, "Уведомления" : { + }, + "Центр авторов" : { + "comment" : "Creator Center" + }, + "Центр помощи" : { + "comment" : "Help Center" }, "Частые вопросы" : { + "comment" : "FAQ navigation title" + }, + "Чаты" : { + }, + "Черновики" : { + "comment" : "Drafts" + }, + "Черновики доступны в боковом меню в разделе Drafts." : { + "comment" : "FAQ answer: drafts" }, "Язык" : { diff --git a/yobble/Views/Tab/CustomTabBar.swift b/yobble/Views/Tab/CustomTabBar.swift index fdf0751..a4f914b 100644 --- a/yobble/Views/Tab/CustomTabBar.swift +++ b/yobble/Views/Tab/CustomTabBar.swift @@ -7,12 +7,12 @@ struct CustomTabBar: View { var body: some View { HStack { // Tab 1: Feed - TabBarButton(systemName: "list.bullet.rectangle", text: "Лента", isSelected: selectedTab == 0) { + TabBarButton(systemName: "list.bullet.rectangle", text: NSLocalizedString("Лента", comment: ""), isSelected: selectedTab == 0) { selectedTab = 0 } // Tab 2: Search - TabBarButton(systemName: "magnifyingglass", text: "Поиск", isSelected: selectedTab == 1) { + TabBarButton(systemName: "magnifyingglass", text: NSLocalizedString("Поиск", comment: ""), isSelected: selectedTab == 1) { selectedTab = 1 } @@ -22,12 +22,12 @@ struct CustomTabBar: View { } // Tab 3: Chats - TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: "Чаты", isSelected: selectedTab == 2) { + TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) { selectedTab = 2 } // Tab 4: Profile - TabBarButton(systemName: "person.crop.square", text: "Лицо", isSelected: selectedTab == 3) { + TabBarButton(systemName: "person.crop.square", text: NSLocalizedString("Лицо", comment: ""), isSelected: selectedTab == 3) { selectedTab = 3 } } diff --git a/yobble/Views/Tab/Settings/FAQView.swift b/yobble/Views/Tab/Settings/FAQView.swift new file mode 100644 index 0000000..b9c07cf --- /dev/null +++ b/yobble/Views/Tab/Settings/FAQView.swift @@ -0,0 +1,47 @@ +import SwiftUI + +struct FAQView: View { + private struct FAQItem: Identifiable { + let id = UUID() + let question: String + let answer: String + } + + private let faqItems: [FAQItem] = [ + FAQItem( + question: NSLocalizedString("Как сбросить пароль?", comment: "FAQ question: reset password"), + answer: NSLocalizedString("Перейдите в раздел \"Настройки > Сменить пароль\" и следуйте инструкциям.", comment: "FAQ answer: reset password") + ), + FAQItem( + question: NSLocalizedString("Где найти сохранённые черновики?", comment: "FAQ question: drafts"), + answer: NSLocalizedString("Черновики доступны в боковом меню в разделе Drafts.", comment: "FAQ answer: drafts") + ), + FAQItem( + question: NSLocalizedString("Как связаться с поддержкой?", comment: "FAQ question: support"), + answer: NSLocalizedString("Напишите нам через форму обратной связи в разделе \"Поддержка\".", comment: "FAQ answer: support") + ) + ] + + var body: some View { + List(faqItems) { item in + VStack(alignment: .leading, spacing: 6) { + Text(item.question) + .font(.headline) + Text(item.answer) + .font(.subheadline) + .foregroundColor(.secondary) + } + .padding(.vertical, 6) + } + .listStyle(.insetGrouped) + .navigationTitle(NSLocalizedString("Частые вопросы", comment: "FAQ navigation title")) + } +} + +struct FAQView_Previews: PreviewProvider { + static var previews: some View { + NavigationView { + FAQView() + } + } +} diff --git a/yobble/Views/Tab/Settings/SettingsView.swift b/yobble/Views/Tab/Settings/SettingsView.swift index 9e2bd40..681eaf5 100644 --- a/yobble/Views/Tab/Settings/SettingsView.swift +++ b/yobble/Views/Tab/Settings/SettingsView.swift @@ -54,7 +54,7 @@ struct SettingsView: View { // MARK: - Поддержка Section(header: Text("Поддержка")) { - NavigationLink(destination: Text("Заглушка: Частые вопросы")) { + NavigationLink(destination: FAQView()) { Label("Частые вопросы", systemImage: "questionmark.circle") } NavigationLink(destination: Text("Заглушка: Обратная связь")) { diff --git a/yobble/Views/Tab/SideMenuView.swift b/yobble/Views/Tab/SideMenuView.swift index a7ef299..bb02157 100644 --- a/yobble/Views/Tab/SideMenuView.swift +++ b/yobble/Views/Tab/SideMenuView.swift @@ -68,6 +68,7 @@ struct SideMenuView: View { @Binding var isPresented: Bool @State private var isAccountListExpanded = false @State private var navigateToSettings = false + @State private var navigateToFAQ = false // Adjustable paddings private let topPadding: CGFloat = 66 @@ -114,6 +115,12 @@ struct SideMenuView: View { ) { EmptyView() } + NavigationLink( + destination: FAQView(), + isActive: $navigateToFAQ + ) { + EmptyView() + } ScrollView(showsIndicators: false) { VStack(alignment: .leading, spacing: 0) { // Parent VStack @@ -203,9 +210,9 @@ struct SideMenuView: View { VStack(alignment: .leading, spacing: 20) { // Section 1 VStack(alignment: .leading, spacing: 7) { - SideMenuButton(icon: "person.2.fill", title: "People You May Like", action: {}) - SideMenuButton(icon: "star.fill", title: "Fun Fest", action: {}) - SideMenuButton(icon: "lightbulb.fill", title: "Creator Center", action: {}) + SideMenuButton(icon: "person.2.fill", title: NSLocalizedString("Люди, которых вы можете знать", comment: "People You May Like"), action: {}) + SideMenuButton(icon: "star.fill", title: NSLocalizedString("Fun Fest", comment: "Fun Fest"), action: {}) + SideMenuButton(icon: "lightbulb.fill", title: NSLocalizedString("Центр авторов", comment: "Creator Center"), action: {}) } Divider() @@ -213,10 +220,10 @@ struct SideMenuView: View { // Section 2 VStack(alignment: .leading, spacing: 7) { Text("CATEGORY").font(.caption2).foregroundColor(.secondary) - SideMenuButton(icon: "doc.text", title: "Drafts", action: {}) - SideMenuButton(icon: "bubble.left", title: "My Comments", action: {}) - SideMenuButton(icon: "clock", title: "History", action: {}) - SideMenuButton(icon: "arrow.down.circle", title: "My Downloads", action: {}) + SideMenuButton(icon: "doc.text", title: NSLocalizedString("Черновики", comment: "Drafts"), action: {}) + SideMenuButton(icon: "bubble.left", title: NSLocalizedString("Мои комментарии", comment: "My Comments"), action: {}) + SideMenuButton(icon: "clock", title: NSLocalizedString("История", comment: "History"), action: {}) + SideMenuButton(icon: "arrow.down.circle", title: NSLocalizedString("Мои загрузки", comment: "My Downloads"), action: {}) } Divider() @@ -224,16 +231,16 @@ struct SideMenuView: View { // Section 3 VStack(alignment: .leading, spacing: 7) { Text("SERVICES").font(.caption2).foregroundColor(.secondary) - SideMenuButton(icon: "shippingbox", title: "Orders", action: {}) - SideMenuButton(icon: "cart", title: "Cart", action: {}) - SideMenuButton(icon: "wallet.pass", title: "Wallet", action: {}) + SideMenuButton(icon: "shippingbox", title: NSLocalizedString("Заказы", comment: "Orders"), action: {}) + SideMenuButton(icon: "cart", title: NSLocalizedString("Корзина", comment: "Cart"), action: {}) + SideMenuButton(icon: "wallet.pass", title: NSLocalizedString("Кошелёк", comment: "Wallet"), action: {}) } Divider() // Section 4 VStack(alignment: .leading, spacing: 15) { - SideMenuButton(icon: "square.grid.2x2", title: "Applets", action: {}) + SideMenuButton(icon: "square.grid.2x2", title: NSLocalizedString("Мини-приложения", comment: "Applets"), action: {}) } } .padding() @@ -247,9 +254,14 @@ struct SideMenuView: View { // Footer HStack(spacing: 20) { Spacer() - SideMenuFooterButton(icon: "qrcode.viewfinder", title: "Scan", action: {}) - SideMenuFooterButton(icon: "questionmark.circle", title: "Help Center", action: {}) - SideMenuFooterButton(icon: "wrench", title: "Settings") { + SideMenuFooterButton(icon: "qrcode.viewfinder", title: NSLocalizedString("Сканировать", comment: "Scan"), action: {}) + SideMenuFooterButton(icon: "questionmark.circle", title: NSLocalizedString("Центр помощи", comment: "Help Center")) { + withAnimation(.easeInOut) { + isPresented = false + } + navigateToFAQ = true + } + SideMenuFooterButton(icon: "gear", title: NSLocalizedString("Настройки", comment: "Settings")) { withAnimation(.easeInOut) { isPresented = false }