From dd21063493e996510186166fcc13409ebcddfe5e Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 17 Sep 2023 14:57:21 +0200 Subject: [PATCH] Update localization --- .../Telegram-iOS/en.lproj/Localizable.strings | 27 +++++++++++ .../Sources/ChatListController.swift | 3 +- .../Sources/ChannelAdminController.swift | 27 ++++------- .../StoryItemSetContainerComponent.swift | 46 +++++++++++++------ .../Sources/PeerInfo/PeerInfoScreen.swift | 3 +- 5 files changed, 71 insertions(+), 35 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index c780283d14..de7e519581 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -10019,3 +10019,30 @@ Sorry for the inconvenience."; "Stats.Boosts.LinkInfo" = "Share this link with your subscribers to get more boosts."; "Conversation.SaveToFiles" = "Save to Files"; + +"ChatList.ContextOpenChannel" = "Open Channel"; + +"Channel.EditAdmin.SectionMessages" = "Manage Messages"; +"Channel.EditAdmin.SectionStories" = "Manage Stories"; + +"Channel.EditAdmin.PermissionEditMessagesOfOthers" = "Edit Messages of Others"; +"Channel.AdminLog.CanEditMessagesOfOthers" = "Edit Messages of Others"; +"Channel.EditAdmin.PermissionPostStories" = "Post Stories"; +"Channel.AdminLog.CanPostStories" = "Post Stories"; +"Channel.EditAdmin.PermissionEditStoriesOfOthers" = "Edit Stories of Others"; +"Channel.AdminLog.CanEditStoriesOfOthers" = "Edit Stories of Others"; +"Channel.EditAdmin.PermissionDeleteStoriesOfOthers" = "Delete Stories of Others"; +"Channel.AdminLog.CanDeleteStoriesOfOthers" = "Delete Stories of Others"; + +"PeerInfo.Channel.ArchivedStories" = "Archived Stories"; + +"Story.SendReactionAsMessage" = "Send reaction as a private message"; + +"Story.ToastRemovedFromChannelText" = "Story removed from the channel's profile"; +"Story.ToastSavedToChannelTitle" = "Story saved to the channel's profile"; +"Story.ToastSavedToChannelText" = "Saved stories can be viewed by others on the channel's profile until an admin removes them."; + +"Story.Context.SaveToChannel" = "Save to Posts"; +"Story.Context.RemoveFromChannel" = "Remove from Posts"; + +"Story.StealthModePlaceholder" = "Stealth Mode active — {m}:{s}"; diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 87eb202ef9..47e16057fe 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -2842,8 +2842,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController }) }))) } else if case .channel = peer { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Open Channel", icon: { theme in + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.ChatList_ContextOpenChannel, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Channels"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in c.dismiss(completion: { diff --git a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift index 1d919f2d0f..849fef5099 100644 --- a/submodules/PeerInfoUI/Sources/ChannelAdminController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelAdminController.swift @@ -501,8 +501,7 @@ private func stringForRight(strings: PresentationStrings, right: TelegramChatAdm return strings.Channel_EditAdmin_PermissionPostMessages } else if right.contains(.canEditMessages) { if isChannel { - //TODO:localize - return "Edit Messages of Others" + return strings.Channel_EditAdmin_PermissionEditMessagesOfOthers } else { return strings.Channel_EditAdmin_PermissionEditMessages } @@ -535,14 +534,11 @@ private func stringForRight(strings: PresentationStrings, right: TelegramChatAdm return strings.Channel_AdminLog_CanManageCalls } } else if right.contains(.canPostStories) { - //TODO:localize - return "Post Stories" + return strings.Channel_EditAdmin_PermissionPostStories } else if right.contains(.canEditStories) { - //TODO:localize - return "Edit Stories of Others" + return strings.Channel_EditAdmin_PermissionEditStoriesOfOthers } else if right.contains(.canDeleteStories) { - //TODO:localize - return "Delete Stories of Others" + return strings.Channel_EditAdmin_PermissionDeleteStoriesOfOthers } else { return "" } @@ -738,12 +734,11 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s enabled = true - //TODO:localize switch type { case .messages: - itemTitle = "Manage Messages" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionMessages case .stories: - itemTitle = "Manage Stories" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionStories } isSelected = subRights.allSatisfy({ currentRightsFlags.contains($0) }) @@ -818,12 +813,11 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s enabled = !state.updating - //TODO:localize switch type { case .messages: - itemTitle = "Manage Messages" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionMessages case .stories: - itemTitle = "Manage Stories" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionStories } isSelected = subRights.allSatisfy({ currentRightsFlags.contains($0) }) @@ -884,12 +878,11 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s continue rightsLoop } - //TODO:localize switch type { case .messages: - itemTitle = "Manage Messages" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionMessages case .stories: - itemTitle = "Manage Stories" + itemTitle = presentationData.strings.Channel_EditAdmin_SectionStories } isSelected = subRights.allSatisfy({ adminInfo.rights.rights.contains($0) }) diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index 85c01f992f..d53bb60c23 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -2687,14 +2687,35 @@ public final class StoryItemSetContainerComponent: Component { let minutes = Int(stealthModeTimeout / 60) let seconds = Int(stealthModeTimeout % 60) - inputPlaceholder = .counter([ - MessageInputPanelComponent.Placeholder.CounterItem(id: 0, content: .text("Stealth Mode active – ")), - MessageInputPanelComponent.Placeholder.CounterItem(id: 1, content: .number(minutes, minDigits: 2)), - MessageInputPanelComponent.Placeholder.CounterItem(id: 2, content: .text(":")), - MessageInputPanelComponent.Placeholder.CounterItem(id: 3, content: .number(seconds, minDigits: 2)), - ]) + let rawString = component.strings.Story_StealthModePlaceholder + var items: [MessageInputPanelComponent.Placeholder.CounterItem] = [] + var startIndex = rawString.startIndex + while true { + if let range = rawString.range(of: "{", range: startIndex ..< rawString.endIndex) { + if range.lowerBound != startIndex { + items.append(MessageInputPanelComponent.Placeholder.CounterItem(id: items.count, content: .text(String(rawString[startIndex ..< range.lowerBound])))) + } + + startIndex = range.upperBound + if let endRange = rawString.range(of: "}", range: startIndex ..< rawString.endIndex) { + let controlString = rawString[range.upperBound ..< endRange.lowerBound] + if controlString == "m" { + items.append(MessageInputPanelComponent.Placeholder.CounterItem(id: items.count, content: .number(minutes, minDigits: 2))) + } else if controlString == "s" { + items.append(MessageInputPanelComponent.Placeholder.CounterItem(id: items.count, content: .number(seconds, minDigits: 2))) + } + + startIndex = endRange.upperBound + } + } else { + break + } + } + if startIndex != rawString.endIndex { + items.append(MessageInputPanelComponent.Placeholder.CounterItem(id: items.count, content: .text(String(rawString[startIndex ..< rawString.endIndex])))) + } - //inputPlaceholder = component.strings.Story_StealthModeActivePlaceholder("\(stringForDuration(stealthModeTimeout))").string + inputPlaceholder = .counter(items) } else { inputPlaceholder = .plain(component.strings.Story_InputPlaceholderReplyPrivately) } @@ -4185,7 +4206,6 @@ public final class StoryItemSetContainerComponent: Component { if let current = self.reactionContextNode { reactionContextNode = current } else { - //TODO:localize reactionContextNodeTransition = .immediate reactionContextNode = ReactionContextNode( context: component.context, @@ -4193,7 +4213,7 @@ public final class StoryItemSetContainerComponent: Component { presentationData: component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme), items: reactionItems.map(ReactionContextItem.reaction), selectedItems: component.slice.item.storyItem.myReaction.flatMap { Set([$0]) } ?? Set(), - title: self.displayLikeReactions ? nil : "Send reaction as a private message", + title: self.displayLikeReactions ? nil : component.strings.Story_SendReactionAsMessage, getEmojiContent: { [weak self] animationCache, animationRenderer in guard let self, let component = self.component else { preconditionFailure() @@ -5823,8 +5843,7 @@ public final class StoryItemSetContainerComponent: Component { } if channel.hasPermission(.editStories) { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: component.slice.item.storyItem.isPinned ? "Remove from Posts" : "Save to Posts", icon: { theme in + items.append(.action(ContextMenuActionItem(text: component.slice.item.storyItem.isPinned ? component.strings.Story_Context_RemoveFromChannel : component.strings.Story_Context_SaveToChannel, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: component.slice.item.storyItem.isPinned ? "Stories/Context Menu/Unpin" : "Stories/Context Menu/Pin"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, a in a(.default) @@ -5836,11 +5855,10 @@ public final class StoryItemSetContainerComponent: Component { let _ = component.context.engine.messages.updateStoriesArePinned(peerId: component.slice.peer.id, ids: [component.slice.item.storyItem.id: component.slice.item.storyItem], isPinned: !component.slice.item.storyItem.isPinned).start() let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme) - //TODO:localize if component.slice.item.storyItem.isPinned { self.scheduledStoryUnpinnedUndoOverlay = UndoOverlayController( presentationData: presentationData, - content: .info(title: nil, text: "Story removed from the channel's profile", timeout: nil), + content: .info(title: nil, text: presentationData.strings.Story_ToastRemovedFromChannelText, timeout: nil), elevatedLayout: false, animateInAsReplacement: false, blurred: true, @@ -5849,7 +5867,7 @@ public final class StoryItemSetContainerComponent: Component { } else { self.component?.presentController(UndoOverlayController( presentationData: presentationData, - content: .info(title: "Story saved to the channel's profile", text: "Saved stories can be viewed by others on the channel's profile until an admin removes them.", timeout: nil), + content: .info(title: presentationData.strings.Story_ToastSavedToChannelTitle, text: presentationData.strings.Story_ToastSavedToChannelText, timeout: nil), elevatedLayout: false, animateInAsReplacement: false, blurred: true, diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 6b50e4e311..ee74fff9d8 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -5448,8 +5448,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } else if let channel = peer as? TelegramChannel { if let cachedData = strongSelf.data?.cachedData as? CachedChannelData { if channel.hasPermission(.editStories) { - //TODO:localize - items.append(.action(ContextMenuActionItem(text: "Archived Stories", icon: { theme in + items.append(.action(ContextMenuActionItem(text: presentationData.strings.PeerInfo_Channel_ArchivedStories, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Archive"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent)