From 16b72bc8ed71aa6af05f15361d708982d8cf4ae6 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Fri, 26 Jul 2024 00:40:31 +0800 Subject: [PATCH] Update localization --- .../Telegram-iOS/en.lproj/Localizable.strings | 41 ++++ .../ChatListSearchFiltersContainerNode.swift | 3 +- .../Sources/ChatListSearchListPaneNode.swift | 11 +- .../Sources/VoiceChatController.swift | 3 +- .../Sources/MiniAppListScreen.swift | 6 +- .../Sources/PeerInfoPaneContainerNode.swift | 3 +- .../Sources/PeerInfoScreen.swift | 206 +----------------- .../Sources/PeerInfoStoryPaneNode.swift | 63 ++---- .../Sources/LanguageSelectionScreen.swift | 3 +- .../StoryItemSetContainerComponent.swift | 8 +- .../Sources/UndoOverlayControllerNode.swift | 1 - .../UrlHandling/Sources/UrlHandling.swift | 6 +- 12 files changed, 87 insertions(+), 267 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 2993d91058..61724087e1 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -12602,3 +12602,44 @@ Sorry for the inconvenience."; "Story.Privacy.ChooseCoverInfo" = "Choose a frame from the story to show in your Profile."; "Story.Privacy.ChooseCoverChannelInfo" = "Choose a frame from the story to show in channel profile."; "Story.Privacy.ChooseCoverGroupInfo" = "Choose a frame from the story to show in group profile."; + +"ChatList.Search.FilterApps" = "Apps"; +"ChatList.Search.SectionPopularApps" = "POPULAR APPS"; +"ChatList.Search.SectionRecentApps" = "APPS YOU USE"; +"ChatList.Search.Apps.Empty.Text" = "No Apps Found"; + +"VoiceChat.MicrophoneModes" = "Microphone Modes"; + +"MiniAppList.Title" = "Examples"; +"MiniAppList.ListSectionHeader" = "APPS THAT ACCEPT STARS"; + +"PeerInfo.PaneBotPreviews" = "Preview"; +"PeerInfo.OpenAppButton" = "Open App"; +"PeerInfo.AppFooterAdmin" = "By publishing this mini app, you agree to the [Telegram Terms of Service for Developers](https://telegram.org/privacy)."; +"PeerInfo.AppFooter" = "By launching this mini app, you agree to the [Terms of Service for Mini Apps](https://telegram.org/privacy)."; +"BotPreviews.MenuAddPreview" = "Add Preview"; +"BotPreviews.MenuReorder" = "Reorder"; +"BotPreviews.MenuDeleteLanguage" = "Delete %@"; +"BotPreviews.SubtitleLoading" = "loading"; +"BotPreviews.SubtitleEmpty" = "no preview added"; +"BotPreviews.SubtitleCount_1" = "1 preview"; +"BotPreviews.SubtitleCount_any" = "1 previews"; +"BotPreviews.SheetDeleteTitle_1" = "Delete 1 Preview?"; +"BotPreviews.SheetDeleteTitle_any" = "Delete %d Previews?"; +"BotPreviews.LanguageTab.Main" = "Main"; +"BotPreviews.LanguageTab.Add" = "+ Add Language"; +"BotPreviews.Empty.Title" = "No Preview"; +"BotPreviews.Empty.Text_1" = "Upload up to 1 screenshot and video demos for your mini app."; +"BotPreviews.Empty.Text_any" = "Upload up to %d screenshots and video demos for your mini app."; +"BotPreviews.Empty.Add" = "Add Preview"; +"BotPreviews.Empty.AddTranslation" = "Create a Translation"; +"BotPreviews.Empty.DeleteTranslation" = "Delete this Translation"; +"BotPreviews.Empty.Separator" = "or"; +"BotPreviews.AlertTooManyPreviews_1" = "You can add at most 1 preview."; +"BotPreviews.AlertTooManyPreviews_any" = "You can add at most 1 previews."; +"BotPreviews.DeleteTranslationAlert.Title" = "Delete Translation"; +"BotPreviews.DeleteTranslationAlert.Text" = "Are you sure you want to delete this translation?"; +"BotPreviews.TranslationFooter.Text" = "This preview will be displayed for all users who have %@ set as their language."; +"BotPreviews.DefaultFooter.Text" = "This preview will be shown by default. You can also add translations into specific languages."; +"BotPreviews.SelectLanguage.Title" = "Add a Translation"; +"BotPreview.ViewContextDelete" = "Delete Preview"; diff --git a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift index 4ac67d6a96..127b853313 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift @@ -88,8 +88,7 @@ private final class ItemNode: ASDisplayNode { title = presentationData.strings.ChatList_Search_FilterChannels icon = nil case .apps: - //TODO:localize - title = "Apps" + title = presentationData.strings.ChatList_Search_FilterApps icon = nil case .media: title = presentationData.strings.ChatList_Search_FilterMedia diff --git a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift index 57c0091630..bcb62df9a9 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift @@ -254,16 +254,15 @@ private enum ChatListRecentEntry: Comparable, Identifiable { } } } else if case .apps = key { - //TODO:localize if case .popularApps = section { - header = ChatListSearchItemHeader(type: .text("POPULAR APPS", 1), theme: theme, strings: strings) + header = ChatListSearchItemHeader(type: .text(presentationData.strings.ChatList_Search_SectionPopularApps, 1), theme: theme, strings: strings) } else { if let isChannelsTabExpanded { - header = ChatListSearchItemHeader(type: .text("APPS YOU USE", 0), theme: theme, strings: strings, actionTitle: isChannelsTabExpanded ? presentationData.strings.ChatList_Search_SectionActionShowLess : presentationData.strings.ChatList_Search_SectionActionShowMore, action: { + header = ChatListSearchItemHeader(type: .text(presentationData.strings.ChatList_Search_SectionRecentApps, 0), theme: theme, strings: strings, actionTitle: isChannelsTabExpanded ? presentationData.strings.ChatList_Search_SectionActionShowLess : presentationData.strings.ChatList_Search_SectionActionShowMore, action: { toggleChannelsTabExpanded() }) } else { - header = ChatListSearchItemHeader(type: .text("APPS YOU USE", 0), theme: theme, strings: strings, actionTitle: nil, action: nil) + header = ChatListSearchItemHeader(type: .text(presentationData.strings.ChatList_Search_SectionRecentApps, 0), theme: theme, strings: strings, actionTitle: nil, action: nil) } } } else { @@ -1454,8 +1453,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode { if key == .channels { emptyRecentTextNode.attributedText = NSAttributedString(string: presentationData.strings.ChatList_Search_RecommendedChannelsEmpty_Text, font: Font.regular(15.0), textColor: presentationData.theme.list.freeTextColor) } else if key == .apps { - //TODO:localize - emptyRecentTextNode.attributedText = NSAttributedString(string: "No Apps Found", font: Font.regular(15.0), textColor: presentationData.theme.list.freeTextColor) + emptyRecentTextNode.attributedText = NSAttributedString(string: presentationData.strings.ChatList_Search_Apps_Empty_Text, font: Font.regular(15.0), textColor: presentationData.theme.list.freeTextColor) } self.emptyRecentTextNode = emptyRecentTextNode @@ -3417,7 +3415,6 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode { continue } let peerNotificationSettings = notificationSettings[id] - //TODO:localize let subpeerSummary: RecentlySearchedPeerSubpeerSummary? = nil var peerStoryStats: PeerStoryStats? if let value = storyStats[peer.id] { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index dc9a008717..b4a2ac7239 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -2627,8 +2627,7 @@ public final class VoiceChatControllerImpl: ViewController, VoiceChatController if !isScheduled && canSpeak { if #available(iOS 15.0, *) { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Microphone Modes", textColor: .primary, icon: { theme in + items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_MicrophoneModes, textColor: .primary, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Call/Context Menu/Noise"), color: theme.actionSheet.primaryTextColor) }, action: { _, f in f(.dismissWithoutContent) diff --git a/submodules/TelegramUI/Components/MiniAppListScreen/Sources/MiniAppListScreen.swift b/submodules/TelegramUI/Components/MiniAppListScreen/Sources/MiniAppListScreen.swift index 08ecaa53f2..579bd7b8d9 100644 --- a/submodules/TelegramUI/Components/MiniAppListScreen/Sources/MiniAppListScreen.swift +++ b/submodules/TelegramUI/Components/MiniAppListScreen/Sources/MiniAppListScreen.swift @@ -246,8 +246,7 @@ final class MiniAppListScreenComponent: Component { ) -> CGFloat { let rightButtons: [AnyComponentWithIdentity] = [] - //TODO:localize - let titleText: String = "Examples" + let titleText: String = strings.MiniAppList_Title let closeTitle: String = strings.Common_Close let headerContent: ChatListHeaderComponent.Content? = ChatListHeaderComponent.Content( @@ -316,12 +315,11 @@ final class MiniAppListScreenComponent: Component { containerSize: size ) - //TODO:localize let sectionHeaderSize = self.sectionHeader.update( transition: transition, component: AnyComponent(ListHeaderComponent( theme: theme, - title: "APPS THAT ACCEPT STARS" + title: strings.MiniAppList_ListSectionHeader )), environment: {}, containerSize: CGSize(width: size.width, height: 1000.0) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoPaneContainerNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoPaneContainerNode.swift index 91606b4938..dd48610be3 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoPaneContainerNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoPaneContainerNode.swift @@ -1126,8 +1126,7 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat case .storyArchive: title = presentationData.strings.PeerInfo_PaneArchivedStories case .botPreview: - //TODO:localize - title = "Preview" + title = presentationData.strings.PeerInfo_PaneBotPreviews case .media: title = presentationData.strings.PeerInfo_PaneMedia case .files: diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index e0669283b2..2ae84f8593 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -1357,8 +1357,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese } else if hasAbout || hasWebApp { var actionButton: PeerInfoScreenLabeledValueItem.Button? if hasWebApp { - //TODO:localize - actionButton = PeerInfoScreenLabeledValueItem.Button(title: "Open App", action: { + actionButton = PeerInfoScreenLabeledValueItem.Button(title: presentationData.strings.PeerInfo_OpenAppButton, action: { guard let parentController = interaction.getController() else { return } @@ -1399,8 +1398,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese })) if let botInfo = user.botInfo, botInfo.flags.contains(.canEdit) { - //TODO:localize - items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: "By publishing this mini app, you agree to the [Telegram Terms of Service for Developers](https://telegram.org/privacy).", linkAction: { action in + items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: presentationData.strings.PeerInfo_AppFooterAdmin, linkAction: { action in if case let .tap(url) = action { context.sharedContext.applicationBindings.openUrl(url) } @@ -1408,8 +1406,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese currentPeerInfoSection = .peerInfoTrailing } else if actionButton != nil { - //TODO:localize - items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: "By launching this mini app, you agree to the [Terms of Service for Mini Apps](https://telegram.org/privacy).", linkAction: { action in + items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: presentationData.strings.PeerInfo_AppFooter, linkAction: { action in if case let .tap(url) = action { context.sharedContext.applicationBindings.openUrl(url) } @@ -10903,14 +10900,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro var items: [ContextMenuItem] = [] let strings = self.presentationData.strings - let _ = strings - - //TODO:localize var ignoreNextActions = false if pane.canAddMoreBotPreviews() { - items.append(.action(ContextMenuActionItem(text: "Add Preview", icon: { theme in + items.append(.action(ContextMenuActionItem(text: strings.BotPreviews_MenuAddPreview, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Add"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, a in if ignoreNextActions { @@ -10956,8 +10950,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro }))) if let language = pane.currentBotPreviewLanguage { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Delete \(language.name)", textColor: .destructive, icon: { theme in + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.BotPreviews_MenuDeleteLanguage(language.name).string, textColor: .destructive, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak pane] _, a in if ignoreNextActions { @@ -14038,192 +14031,3 @@ private final class HeaderContextReferenceContentSource: ContextReferenceContent return ContextControllerReferenceViewInfo(referenceView: self.sourceView, contentAreaInScreenSpace: UIScreen.main.bounds) } } - -/*private func openWebApp(parentController: ViewController, context: AccountContext, peer: EnginePeer, buttonText: String, url: String, simple: Bool, source: ChatOpenWebViewSource) { - let presentationData = context.sharedContext.currentPresentationData.with({ $0 }) - - let botName: String - let botAddress: String - let botVerified: Bool - if case let .inline(bot) = source { - botName = bot.compactDisplayTitle - botAddress = bot.addressName ?? "" - botVerified = bot.isVerified - } else { - botName = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) - botAddress = peer.addressName ?? "" - botVerified = peer.isVerified - } - - let _ = botAddress - - let openWebView = { [weak parentController] in - guard let parentController else { - return - } - - if source == .menu { - if let navigationController = parentController.navigationController as? NavigationController, let minimizedContainer = navigationController.minimizedContainer { - for controller in minimizedContainer.controllers { - if let controller = controller as? AttachmentController, let mainController = controller.mainController as? WebAppController, mainController.botId == peer.id && mainController.source == .menu { - navigationController.maximizeViewController(controller, animated: true) - return - } - } - } - - var fullSize = false - if isTelegramMeLink(url), let internalUrl = parseFullInternalUrl(sharedContext: context.sharedContext, url: url), case .peer(_, .appStart) = internalUrl { - fullSize = !url.contains("?mode=compact") - } - - var presentImpl: ((ViewController, Any?) -> Void)? - let params = WebAppParameters(source: .menu, peerId: peer.id, botId: peer.id, botName: botName, botVerified: botVerified, url: url, queryId: nil, payload: nil, buttonText: buttonText, keepAliveSignal: nil, forceHasSettings: false, fullSize: fullSize) - //TODO:localize - //updatedPresentationData - let controller = standaloneWebAppController(context: context, updatedPresentationData: nil, params: params, threadId: nil, openUrl: { [weak parentController] url, concealed, commit in - guard let parentController else { - return - } - let _ = parentController - /*ChatControllerImpl.botOpenUrl(context: context, peerId: peerId, controller: self, url: url, concealed: concealed, present: { c, a in - presentImpl?(c, a) - }, commit: commit)*/ - }, requestSwitchInline: { [weak parentController] query, chatTypes, completion in - guard let parentController else { - return - } - let _ = parentController - //ChatControllerImpl.botRequestSwitchInline(context: context, controller: self, peerId: peerId, botAddress: botAddress, query: query, chatTypes: chatTypes, completion: completion) - }, getInputContainerNode: { - return nil - }, completion: { - }, willDismiss: { - }, didDismiss: { - }, getNavigationController: { [weak parentController] () -> NavigationController? in - guard let parentController else { - return nil - } - return parentController.navigationController as? NavigationController ?? context.sharedContext.mainWindow?.viewController as? NavigationController - }) - controller.navigationPresentation = .flatModal - parentController.push(controller) - - presentImpl = { [weak controller] c, a in - controller?.present(c, in: .window(.root), with: a) - } - let _ = presentImpl - } else if simple { - var isInline = false - var botId = peer.id - var botName = botName - var botAddress = "" - var botVerified = false - if case let .inline(bot) = source { - isInline = true - botId = bot.id - botName = bot.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) - botAddress = bot.addressName ?? "" - botVerified = bot.isVerified - } - - let _ = botAddress - - let _ = ((context.engine.messages.requestSimpleWebView(botId: botId, url: url, source: isInline ? .inline : .generic, themeParams: generateWebAppThemeParams(presentationData.theme))) - |> deliverOnMainQueue).startStandalone(next: { [weak parentController] result in - guard let parentController else { - return - } - var presentImpl: ((ViewController, Any?) -> Void)? - let params = WebAppParameters(source: isInline ? .inline : .simple, peerId: peer.id, botId: botId, botName: botName, botVerified: botVerified, url: result.url, queryId: nil, payload: nil, buttonText: buttonText, keepAliveSignal: nil, forceHasSettings: false, fullSize: result.flags.contains(.fullSize)) - let controller = standaloneWebAppController(context: context, updatedPresentationData: nil, params: params, threadId: nil, openUrl: { [weak parentController] url, concealed, commit in - guard let parentController else { - return - } - let _ = parentController - /*ChatControllerImpl.botOpenUrl(context: context, peerId: peerId, controller: self, url: url, concealed: concealed, present: { c, a in - presentImpl?(c, a) - }, commit: commit)*/ - }, requestSwitchInline: { query, chatTypes, completion in - //ChatControllerImpl.botRequestSwitchInline(context: context, controller: self, peerId: peerId, botAddress: botAddress, query: query, chatTypes: chatTypes, completion: completion) - }, getNavigationController: { [weak parentController] in - guard let parentController else { - return nil - } - return parentController.navigationController as? NavigationController ?? context.sharedContext.mainWindow?.viewController as? NavigationController - }) - controller.navigationPresentation = .flatModal - parentController.push(controller) - - presentImpl = { [weak controller] c, a in - controller?.present(c, in: .window(.root), with: a) - } - let _ = presentImpl - }, error: { [weak parentController] error in - guard let parentController else { - return - } - parentController.present(textAlertController(context: context, updatedPresentationData: nil, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: { - })]), in: .window(.root)) - }) - } else { - let _ = ((context.engine.messages.requestWebView(peerId: peer.id, botId: peer.id, url: !url.isEmpty ? url : nil, payload: nil, themeParams: generateWebAppThemeParams(presentationData.theme), fromMenu: false, replyToMessageId: nil, threadId: nil)) - |> deliverOnMainQueue).startStandalone(next: { [weak parentController] result in - guard let parentController else { - return - } - var presentImpl: ((ViewController, Any?) -> Void)? - let context = context - let params = WebAppParameters(source: .button, peerId: peer.id, botId: peer.id, botName: botName, botVerified: botVerified, url: result.url, queryId: result.queryId, payload: nil, buttonText: buttonText, keepAliveSignal: result.keepAliveSignal, forceHasSettings: false, fullSize: result.flags.contains(.fullSize)) - let controller = standaloneWebAppController(context: context, updatedPresentationData: nil, params: params, threadId: nil, openUrl: { [weak parentController] url, concealed, commit in - guard let parentController else { - return - } - let _ = parentController - /*ChatControllerImpl.botOpenUrl(context: context, peerId: peerId, controller: self, url: url, concealed: concealed, present: { c, a in - presentImpl?(c, a) - }, commit: commit)*/ - }, completion: { - }, getNavigationController: { [weak parentController] in - guard let parentController else { - return nil - } - return parentController.navigationController as? NavigationController ?? context.sharedContext.mainWindow?.viewController as? NavigationController - }) - controller.navigationPresentation = .flatModal - parentController.push(controller) - - presentImpl = { [weak controller] c, a in - controller?.present(c, in: .window(.root), with: a) - } - let _ = presentImpl - }, error: { [weak parentController] error in - guard let parentController else { - return - } - parentController.present(textAlertController(context: context, updatedPresentationData: nil, title: nil, text: presentationData.strings.Login_UnknownError, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: { - })]), in: .window(.root)) - }) - } - } - - var botPeer = peer - if case let .inline(bot) = source { - botPeer = bot - } - let _ = (ApplicationSpecificNotice.getBotGameNotice(accountManager: context.sharedContext.accountManager, peerId: botPeer.id) - |> deliverOnMainQueue).startStandalone(next: { [weak parentController] value in - guard let parentController else { - return - } - if value { - openWebView() - } else { - let controller = webAppLaunchConfirmationController(context: context, updatedPresentationData: nil, peer: botPeer, completion: { _ in - let _ = ApplicationSpecificNotice.setBotGameNotice(accountManager: context.sharedContext.accountManager, peerId: botPeer.id).startStandalone() - openWebView() - }, showMore: nil) - parentController.present(controller, in: .window(.root)) - } - }) -}*/ diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift index 6a13db508e..15327d43df 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoStoryPaneNode.swift @@ -2504,8 +2504,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: isPinned ? "anim_toastunpin" : "anim_toastpin", scale: 0.06, colors: [:], title: toastTitle, text: toastText, customUndoText: nil, timeout: 5), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) }))) if isPinned && self.canReorder() { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Reorder", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.BotPreviews_MenuReorder, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in c?.dismiss(completion: { guard let self else { return @@ -2569,8 +2568,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr } if canManage, case .botPreview = self.scope, self.canReorder() { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Reorder", icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.BotPreviews_MenuReorder, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in c?.dismiss(completion: { guard let self else { return @@ -2738,11 +2736,10 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr let title: String if state.totalCount == 0 { if case .botPreview = self.scope { - //TODO:localize if state.isLoading { - title = "loading" + title = self.presentationData.strings.BotPreviews_SubtitleLoading } else { - title = "no preview added" + title = self.presentationData.strings.BotPreviews_SubtitleEmpty } } else { title = "" @@ -2756,12 +2753,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr title = self.presentationData.strings.StoryList_SubtitleCount(Int32(state.totalCount)) } } else if case .botPreview = self.scope { - //TODO:localize - if state.totalCount == 1 { - title = "1 preview" - } else { - title = "\(state.totalCount) previews" - } + title = self.presentationData.strings.BotPreviews_SubtitleCount(Int32(state.totalCount)) } else { title = "" } @@ -3357,18 +3349,12 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr return } - //TODO:localize - let title: String - if mappedMedia.count == 1 { - title = "Delete 1 Preview?" - } else { - title = "Delete \(mappedMedia.count) Previews?" - } + let title: String = presentationData.strings.BotPreviews_SheetDeleteTitle(Int32(mappedMedia.count)) controller.setItemGroups([ ActionSheetItemGroup(items: [ ActionSheetTextItem(title: title), - ActionSheetButtonItem(title: "Delete", color: .destructive, action: { [weak self] in + ActionSheetButtonItem(title: presentationData.strings.Common_Delete, color: .destructive, action: { [weak self] in dismissAction() guard let self else { @@ -3572,11 +3558,10 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.botPreviewLanguageTab = botPreviewLanguageTab } - //TODO:localize var languageItems: [TabSelectorComponent.Item] = [] languageItems.append(TabSelectorComponent.Item( id: AnyHashable("_main"), - title: "Main" + title: self.presentationData.strings.BotPreviews_LanguageTab_Main )) for language in self.currentBotPreviewLanguages { languageItems.append(TabSelectorComponent.Item( @@ -3586,7 +3571,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr } languageItems.append(TabSelectorComponent.Item( id: AnyHashable("_add"), - title: "+ Add Language" + title: self.presentationData.strings.BotPreviews_LanguageTab_Add )) var selectedLanguageId = "_main" if let listSource = self.listSource as? BotPreviewStoryListContext, let language = listSource.language { @@ -3653,9 +3638,10 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr let text: String if let listSource = self.listSource as? BotPreviewStoryListContext, let id = listSource.language, let language = self.currentBotPreviewLanguages.first(where: { $0.id == id }) { isMainLanguage = false - text = "This preview will be displayed for all users who have \(language.name) set as their language." + + text = self.presentationData.strings.BotPreviews_TranslationFooter_Text(language.name).string } else { - text = "This preview will be shown by default. You can also add translations into specific languages." + text = self.presentationData.strings.BotPreviews_DefaultFooter_Text } let botPreviewFooterSize = botPreviewFooter.update( @@ -3667,7 +3653,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr animationName: nil, title: nil, text: text, - actionTitle: "Add Preview", + actionTitle: self.presentationData.strings.BotPreviews_Empty_Add, action: { [weak self] in guard let self else { return @@ -3678,7 +3664,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.presentUnableToAddMorePreviewsAlert() } }, - additionalActionTitle: isMainLanguage ? "Create a Translation" : nil, + additionalActionTitle: isMainLanguage ? self.presentationData.strings.BotPreviews_Empty_AddTranslation : nil, additionalAction: { [weak self] in guard let self else { return @@ -3687,7 +3673,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.presentAddBotPreviewLanguage() } }, - additionalActionSeparator: isMainLanguage ? "or" : nil + additionalActionSeparator: isMainLanguage ? self.presentationData.strings.BotPreviews_Empty_Separator : nil )), environment: {}, containerSize: CGSize(width: size.width, height: 1000.0) @@ -4032,7 +4018,6 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr emptyStateView = ComponentView() self.emptyStateView = emptyStateView } - //TODO:localize var isMainLanguage = true if let listSource = self.listSource as? BotPreviewStoryListContext, let _ = listSource.language { @@ -4046,9 +4031,9 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr theme: presentationData.theme, fitToHeight: self.isProfileEmbedded, animationName: nil, - title: "No Preview", - text: "Upload up to \(self.maxBotPreviewCount) screenshots and video demos for your mini app.", - actionTitle: self.canManageStories ? "Add Preview" : nil, + title: presentationData.strings.BotPreviews_Empty_Title, + text: presentationData.strings.BotPreviews_Empty_Text(Int32(self.maxBotPreviewCount)), + actionTitle: self.canManageStories ? presentationData.strings.BotPreviews_Empty_Add : nil, action: { [weak self] in guard let self else { return @@ -4059,7 +4044,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.presentUnableToAddMorePreviewsAlert() } }, - additionalActionTitle: self.canManageStories ? (isMainLanguage ? "Create a Translation" : "Delete this Translation") : nil, + additionalActionTitle: self.canManageStories ? (isMainLanguage ? presentationData.strings.BotPreviews_Empty_AddTranslation : presentationData.strings.BotPreviews_Empty_DeleteTranslation) : nil, additionalAction: { if isMainLanguage { self.presentAddBotPreviewLanguage() @@ -4067,7 +4052,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr self.presentDeleteBotPreviewLanguage() } }, - additionalActionSeparator: self.canManageStories ? "or" : nil + additionalActionSeparator: self.canManageStories ? presentationData.strings.BotPreviews_Empty_Separator : nil )), environment: {}, containerSize: CGSize(width: size.width, height: size.height - gridTopInset - bottomInset) @@ -4267,19 +4252,17 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr } public func presentUnableToAddMorePreviewsAlert() { - //TODO:localize - self.parentController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: "You can add at most \(self.maxBotPreviewCount) previews.", actions: [ + self.parentController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: nil, text: self.presentationData.strings.BotPreviews_AlertTooManyPreviews(Int32(self.maxBotPreviewCount)), actions: [ TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_OK, action: { }) ], parseMarkdown: true), in: .window(.root)) } public func presentDeleteBotPreviewLanguage() { - //TODO:localize - self.parentController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: "Delete Translation", text: "Are you sure you want to delete this translation?", actions: [ + self.parentController?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: self.presentationData.strings.BotPreviews_DeleteTranslationAlert_Title, text: self.presentationData.strings.BotPreviews_DeleteTranslationAlert_Text, actions: [ TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_Cancel, action: { }), - TextAlertAction(type: .destructiveAction, title: "OK", action: { [weak self] in + TextAlertAction(type: .destructiveAction, title: self.presentationData.strings.Common_OK, action: { [weak self] in guard let self else { return } diff --git a/submodules/TelegramUI/Components/Settings/LanguageSelectionScreen/Sources/LanguageSelectionScreen.swift b/submodules/TelegramUI/Components/Settings/LanguageSelectionScreen/Sources/LanguageSelectionScreen.swift index 7b5bebee31..9d698608da 100644 --- a/submodules/TelegramUI/Components/Settings/LanguageSelectionScreen/Sources/LanguageSelectionScreen.swift +++ b/submodules/TelegramUI/Components/Settings/LanguageSelectionScreen/Sources/LanguageSelectionScreen.swift @@ -42,8 +42,7 @@ public class LanguageSelectionScreen: ViewController { self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style self.navigationPresentation = .modal - //TODO:localize - self.title = "Add a Translation" + self.title = self.presentationData.strings.BotPreviews_SelectLanguage_Title self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil) diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index 738ada201f..2db32693a4 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -5655,8 +5655,7 @@ public final class StoryItemSetContainerComponent: Component { let deleteTitle: String if case let .user(user) = component.slice.peer, user.botInfo != nil { - //TODO:localize - deleteTitle = "Delete Preview" + deleteTitle = component.strings.BotPreview_ViewContextDelete } else { deleteTitle = component.strings.Story_ContextDeleteStory } @@ -6604,8 +6603,7 @@ public final class StoryItemSetContainerComponent: Component { if case let .user(user) = component.slice.peer, let botInfo = user.botInfo { if botInfo.flags.contains(.canEdit) { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Reorder", icon: { theme in + items.append(.action(ContextMenuActionItem(text: presentationData.strings.BotPreviews_MenuReorder, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/ReorderItems"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, a in a(.default) @@ -6616,7 +6614,7 @@ public final class StoryItemSetContainerComponent: Component { component.reorder() }))) - items.append(.action(ContextMenuActionItem(text: "Delete", textColor: .destructive, icon: { theme in + items.append(.action(ContextMenuActionItem(text: presentationData.strings.Common_Delete, textColor: .destructive, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { [weak self] _, a in a(.default) diff --git a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift index 59b63dd909..d9398de8a4 100644 --- a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift +++ b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift @@ -437,7 +437,6 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode { self.textNode.visibility = true } - //TODO:localize self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(14.0), textColor: .white) displayUndo = false diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index f8fb3f07c5..af85edc262 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -1203,7 +1203,11 @@ public func resolveUrlImpl(context: AccountContext, peerId: PeerId?, url: String var url = url if !url.contains("://") && !url.hasPrefix("tel:") && !url.hasPrefix("mailto:") && !url.hasPrefix("calshow:") { if !(url.hasPrefix("http") || url.hasPrefix("https")) { - url = "http://\(url)" + if let mappedURL = URL(string: "https://\(url)"), let host = mappedURL.host, host.lowercased().hasSuffix(".ton") { + url = "tonsite://\(url)" + } else { + url = "http://\(url)" + } } }