From 33dc13f2d5badbf38393873fbefe147a21b5229a Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 27 Nov 2022 23:01:27 +0400 Subject: [PATCH] Update localization --- .../Telegram-iOS/en.lproj/Localizable.strings | 63 ++++++++ .../Sources/ChatListController.swift | 5 +- .../Sources/Node/ChatListNode.swift | 6 +- .../GlobalAutoremoveScreen.swift | 43 +++--- .../PrivacyAndSecurityController.swift | 9 +- .../Sources/NumericFormat.swift | 135 ++++++++++++++---- .../Sources/CreateGroupController.swift | 13 +- 7 files changed, 199 insertions(+), 75 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index acbad4386c..bc27e2960c 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -8337,3 +8337,66 @@ Sorry for the inconvenience."; "UserInfo.AnonymousNumberInfo" = "This number is not tied to a SIM card and was acquired on [Fragment]()."; "Login.NewNumber" = "New Number"; + +"ChatList.GeneralHidden" = "General hidden"; +"ChatList.GeneralHiddenInfo" = "Pull down to see the general topic."; +"ChatList.GeneralUnhidden" = "General unhidden"; +"ChatList.GeneralUnhiddenInfo" = "Swipe left on the general topic to hide it."; + +"Autoremove.OptionOff" = "Off"; +"Autoremove.SetCustomTime" = "Set Custom Time..."; +"CreateGroup.AutoDeleteTitle" = "Auto-Delete Messages"; +"CreateGroup.AutoDeleteText" = "Automatically delete messages sent in this group for everyone after a period of time."; + +"Settings.AutoDeleteTitle" = "Auto-Delete Messages"; +"Settings.AutoDeleteInfo" = "Automatically delete messages for everyone after a period of time in all new chats you start."; + +"Time.AfterSeconds_1" = "%@ second"; +"Time.AfterSeconds_any" = "%@ seconds"; +"Time.AfterMinutes_1" = "%@ minute"; +"Time.AfterMinutes_any" = "%@ minutes"; +"Time.AfterHours_1" = "%@ hour"; +"Time.AfterHours_any" = "%@ hours"; +"Time.AfterDays_1" = "%@ day"; +"Time.AfterDays_any" = "%@ days"; +"Time.AfterWeeks_1" = "%@ week"; +"Time.AfterWeeks_any" = "%@ weeks"; +"Time.AfterMonths_1" = "%@ month"; +"Time.AfterMonths_any" = "%@ months"; +"Time.AfterYears_1" = "%@ years"; +"Time.AfterYears_any" = "%@ years"; + +"Time.TimerSeconds_1" = "%@-second"; +"Time.TimerSeconds_any" = "%@-second"; +"Time.TimerMinutes_1" = "%@-minute"; +"Time.TimerMinutes_any" = "%@-minute"; +"Time.TimerHours_1" = "%@-hour"; +"Time.TimerHours_any" = "%@-hour"; +"Time.TimerDays_1" = "%@-day"; +"Time.TimerDays_any" = "%@-day"; +"Time.TimerWeeks_1" = "%@-week"; +"Time.TimerWeeks_any" = "%@-week"; +"Time.TimerMonths_1" = "%@-month"; +"Time.TimerMonths_any" = "%@-month"; +"Time.TimerYears_1" = "%@-year"; +"Time.TimerYears_any" = "%@-year"; + +"ChatList.LabelAutodeleteAfter" = "auto-delete after %@"; +"ChatList.LabelAutodeleteDisabled" = "auto-deletion disabled"; + +"GlobalAutodeleteSettings.Title" = "Auto-Delete Messages"; +"GlobalAutodeleteSettings.OptionsHeader" = "SELF-DESTRUCT TIMER"; +"GlobalAutodeleteSettings.OptionTitle" = "After %@"; +"GlobalAutodeleteSettings.SetCustomTime" = "Set Custom Time..."; +"GlobalAutodeleteSettings.InfoDisabled" = "If enabled, all new messages in chats you start will be automatically deleted for everyone at some point after they have been sent. This will not affect your existing chats."; +"GlobalAutodeleteSettings.InfoEnabled" = "All new messages in chats you started will be automatically deleted for everyone %@ after they have been sent. You can also [apply this setting for your existing chats]()."; +"GlobalAutodeleteSettings.SetConfirmTitle" = "Self-Destruct Timer"; +"GlobalAutodeleteSettings.SetConfirmText" = "Are you sure you want all messages in your new private chats and in new groups you create to be automatically deleted for everyone %@ after they have been sent?"; +"GlobalAutodeleteSettings.SetConfirmAction" = "Enable Auto-Deletion"; +"GlobalAutodeleteSettings.SetConfirmToastEnabled" = "Messages in all new chats you start will be automatically deleted after %@."; +"GlobalAutodeleteSettings.SetConfirmToastDisabled" = "Messages in all new chats you start will not be automatically deleted."; +"GlobalAutodeleteSettings.ApplyChatsTitle" = "Select Chats"; +"GlobalAutodeleteSettings.ApplyChatsPlaceholder" = "Select chats to apply the %@ self-destruct timer"; +"GlobalAutodeleteSettings.ApplyChatsToast" = "You applied the %1$@ self-destruct timer to %2$@."; +"GlobalAutodeleteSettings.ApplyChatsSubject_1" = "%@ chat"; +"GlobalAutodeleteSettings.ApplyChatsSubject_any" = "%@ chats"; diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 04c2b38545..923ffd73ec 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -3653,8 +3653,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } if isHidden { - //TODO:localize - strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .hidArchive(title: "General hidden", text: "Pull down to see the general topic.", undo: false), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] value in + strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .hidArchive(title: strongSelf.presentationData.strings.ChatList_GeneralHidden, text: strongSelf.presentationData.strings.ChatList_GeneralHiddenInfo, undo: false), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] value in guard let strongSelf = self else { return false } @@ -3665,7 +3664,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController return false }), in: .current) } else { - strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .revealedArchive(title: "General unhidden", text: "Swipe left on the general topic to hide it.", undo: false), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false + strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .revealedArchive(title: strongSelf.presentationData.strings.ChatList_GeneralUnhidden, text: strongSelf.presentationData.strings.ChatList_GeneralUnhiddenInfo, undo: false), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .current) } } diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift index 1d12cc33e0..b01c44204a 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift @@ -2972,11 +2972,9 @@ private func statusStringForPeerType(accountPeerId: EnginePeer.Id, strings: Pres if displayAutoremoveTimeout { if let autoremoveTimeout = autoremoveTimeout { - //TODO:localize - return ("auto-delete after \(timeIntervalString(strings: strings, value: autoremoveTimeout))", false, true, .autoremove) + return (strings.ChatList_LabelAutodeleteAfter(timeIntervalString(strings: strings, value: autoremoveTimeout, usage: .afterTime)).string, false, true, .autoremove) } else { - //TODO:localize - return ("auto-deletion disabled", false, false, .autoremove) + return (strings.ChatList_LabelAutodeleteDisabled, false, false, .autoremove) } } diff --git a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift index 27c3b92a6b..3e1d9544c7 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/GlobalAutoremoveScreen.swift @@ -149,8 +149,7 @@ private func globalAutoremoveScreenEntries(presentationData: PresentationData, s let effectiveCurrentValue = state.updatedValue - //TODO:localize - entries.append(.sectionHeader("SELF-DESTRUCT TIMER")) + entries.append(.sectionHeader(presentationData.strings.GlobalAutodeleteSettings_OptionsHeader)) var values: [Int32] = [ 0, @@ -170,25 +169,22 @@ private func globalAutoremoveScreenEntries(presentationData: PresentationData, s values.sort() - //TODO:localize for value in values { let text: String if value == 0 { - text = "Off" + text = presentationData.strings.Autoremove_OptionOff } else { - text = "After \(timeIntervalString(strings: presentationData.strings, value: value))" + text = presentationData.strings.GlobalAutodeleteSettings_OptionTitle(timeIntervalString(strings: presentationData.strings, value: value, usage: .afterTime)).string } entries.append(.timerOption(value: value, text: text, isSelected: effectiveCurrentValue == value)) } - entries.append(.customAction("Set Custom Time...")) + entries.append(.customAction(presentationData.strings.GlobalAutodeleteSettings_SetCustomTime)) - //TODO:localize if effectiveCurrentValue == 0 { - entries.append(.info("If enabled, all new messages in chats you start will be automatically deleted for everyone at some point after they have been sent. This will not affect your existing chats.")) + entries.append(.info(presentationData.strings.GlobalAutodeleteSettings_InfoDisabled)) } else { - - entries.append(.info("All new messages in chats you started will be automatically deleted for everyone \(timeIntervalString(strings: presentationData.strings, value: effectiveCurrentValue)) after they have been sent. You can also [apply this setting for your existing chats]().")) + entries.append(.info(presentationData.strings.GlobalAutodeleteSettings_InfoEnabled(timeIntervalString(strings: presentationData.strings, value: effectiveCurrentValue, usage: .afterTime)).string)) } return entries @@ -237,10 +233,10 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32, var isOn: Bool = true var text: String? if timeout != 0 { - text = "Messages in all new chats you start will be automatically deleted after \(timeIntervalString(strings: presentationData.strings, value: timeout))." + text = presentationData.strings.GlobalAutodeleteSettings_SetConfirmToastEnabled(timeIntervalString(strings: presentationData.strings, value: timeout, usage: .afterTime)).string } else { isOn = false - text = "Messages in all new chats you start will not be automatically deleted."; + text = presentationData.strings.GlobalAutodeleteSettings_SetConfirmToastDisabled } if let text = text { var animateAsReplacement = false @@ -264,14 +260,13 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32, apply(timeout) } else { let presentationData = context.sharedContext.currentPresentationData.with { $0 } - //TODO:localize - let valueText = timeIntervalString(strings: presentationData.strings, value: timeout) + let valueText = timeIntervalString(strings: presentationData.strings, value: timeout, usage: .afterTime) presentControllerImpl?(standardTextAlertController( theme: AlertControllerTheme(presentationData: presentationData), - title: "Self-Destruct Timer", - text: "Are you sure you want all messages in your new private chats and in new groups you create to be automatically deleted for everyone \(valueText) after they have been sent?", + title: presentationData.strings.GlobalAutodeleteSettings_SetConfirmTitle, + text: presentationData.strings.GlobalAutodeleteSettings_SetConfirmText(valueText).string, actions: [ - TextAlertAction(type: .defaultAction, title: "Enable Auto-Deletion", action: { + TextAlertAction(type: .defaultAction, title: presentationData.strings.GlobalAutodeleteSettings_SetConfirmAction, action: { apply(timeout) }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}) @@ -299,16 +294,14 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32, return } - //TODO:localize let presentationData = context.sharedContext.currentPresentationData.with { $0 } - let valueText = timeIntervalString(strings: presentationData.strings, value: value) + let valueText = timeIntervalString(strings: presentationData.strings, value: value, usage: .timer) - //TODO:localize let selectionController = context.sharedContext.makeContactMultiselectionController(ContactMultiselectionControllerParams( context: context, mode: .chatSelection(ContactMultiselectionControllerMode.ChatSelection( - title: "Select Chats", - searchPlaceholder: "Select chats to apply the \(valueText) self-destruct timer", + title: presentationData.strings.GlobalAutodeleteSettings_ApplyChatsTitle, + searchPlaceholder: presentationData.strings.GlobalAutodeleteSettings_ApplyChatsPlaceholder(valueText).string, selectedChats: Set(), additionalCategories: nil, chatListFilters: nil, @@ -362,8 +355,7 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32, selectionController?.dismiss() let isOn: Bool = true - //TODO:localize - let text = "You applied the \(timeIntervalString(strings: presentationData.strings, value: value)) self-destruct timer to \(peerIds.count) \(peerIds.count == 1 ? "chat" : "chats")." + let text = presentationData.strings.GlobalAutodeleteSettings_ApplyChatsToast(timeIntervalString(strings: presentationData.strings, value: value, usage: .timer), presentationData.strings.GlobalAutodeleteSettings_ApplyChatsSubject(Int32(peerIds.count))).string var animateAsReplacement = false if let window = getController?()?.window { @@ -390,8 +382,7 @@ public func globalAutoremoveScreen(context: AccountContext, initialValue: Int32, |> map { presentationData, state -> (ItemListControllerState, (ItemListNodeState, Any)) in let rightNavigationButton: ItemListNavigationButton? = nil - //TODO:localize - let title: ItemListControllerTitle = .text("Auto-Delete Messages") + let title: ItemListControllerTitle = .text(presentationData.strings.GlobalAutodeleteSettings_Title) let entries: [GlobalAutoremoveEntry] = globalAutoremoveScreenEntries(presentationData: presentationData, state: state) diff --git a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift index 4f6b695dde..6c7175ce58 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/PrivacyAndSecurityController.swift @@ -514,7 +514,6 @@ private func privacyAndSecurityControllerEntries( } entries.append(.twoStepVerification(presentationData.theme, presentationData.strings.PrivacySettings_TwoStepAuth, twoStepAuthString, twoStepAuthData)) - //TODO:localize if let privacySettings = privacySettings { let value: Int32? if let updatingMessageAutoremoveTimeoutValue = state.updatingMessageAutoremoveTimeoutValue { @@ -526,13 +525,13 @@ private func privacyAndSecurityControllerEntries( if let value { valueText = timeIntervalString(strings: presentationData.strings, value: value) } else { - valueText = "Off" + valueText = presentationData.strings.Autoremove_OptionOff } - entries.append(.messageAutoremoveTimeout(presentationData.theme, "Auto-Delete Messages", valueText)) + entries.append(.messageAutoremoveTimeout(presentationData.theme, presentationData.strings.Settings_AutoDeleteTitle, valueText)) } else { - entries.append(.messageAutoremoveTimeout(presentationData.theme, "Auto-Delete Messages", presentationData.strings.Channel_NotificationLoading)) + entries.append(.messageAutoremoveTimeout(presentationData.theme, presentationData.strings.Settings_AutoDeleteTitle, presentationData.strings.Channel_NotificationLoading)) } - entries.append(.messageAutoremoveInfo(presentationData.theme, "Automatically delete messages for everyone after a period of time in all new chats you start.")) + entries.append(.messageAutoremoveInfo(presentationData.theme, presentationData.strings.Settings_AutoDeleteInfo)) if loginEmail != nil { entries.append(.loginEmail(presentationData.theme, presentationData.strings.PrivacySettings_LoginEmail, loginEmail)) diff --git a/submodules/TelegramPresentationData/Sources/NumericFormat.swift b/submodules/TelegramPresentationData/Sources/NumericFormat.swift index 8ba787641f..b29024c88c 100644 --- a/submodules/TelegramPresentationData/Sources/NumericFormat.swift +++ b/submodules/TelegramPresentationData/Sources/NumericFormat.swift @@ -50,38 +50,115 @@ public func minutesIntervalString(strings: PresentationStrings, minutes: Int32) return strings.MessageTimer_Minutes(max(0, minutes)) } -public func timeIntervalString(strings: PresentationStrings, value: Int32, preferLowerValue: Bool = false) -> String { - if preferLowerValue { - if value <= 60 { - return strings.MessageTimer_Seconds(max(1, value)) - } else if value <= 60 * 60 { - return strings.MessageTimer_Minutes(max(1, value / 60)) - } else if value <= 60 * 60 * 24 { - return strings.MessageTimer_Hours(max(1, value / (60 * 60))) - } else if value <= 60 * 60 * 24 * 7 { - return strings.MessageTimer_Days(max(1, value / (60 * 60 * 24))) - } else if value <= 60 * 60 * 24 * 30 { - return strings.MessageTimer_Weeks(max(1, value / (60 * 60 * 24 * 7))) - } else if value <= 60 * 60 * 24 * 365 { - return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30))) +public enum TimeIntervalStringUsage { + case generic + case afterTime + case timer +} + +public func timeIntervalString(strings: PresentationStrings, value: Int32, usage: TimeIntervalStringUsage = .generic, preferLowerValue: Bool = false) -> String { + switch usage { + case .generic: + if preferLowerValue { + if value <= 60 { + return strings.MessageTimer_Seconds(max(1, value)) + } else if value <= 60 * 60 { + return strings.MessageTimer_Minutes(max(1, value / 60)) + } else if value <= 60 * 60 * 24 { + return strings.MessageTimer_Hours(max(1, value / (60 * 60))) + } else if value <= 60 * 60 * 24 * 7 { + return strings.MessageTimer_Days(max(1, value / (60 * 60 * 24))) + } else if value <= 60 * 60 * 24 * 30 { + return strings.MessageTimer_Weeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value <= 60 * 60 * 24 * 365 { + return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.MessageTimer_Years(max(1, value / (60 * 60 * 24 * 365))) + } } else { - return strings.MessageTimer_Years(max(1, value / (60 * 60 * 24 * 365))) + if value < 60 { + return strings.MessageTimer_Seconds(max(1, value)) + } else if value < 60 * 60 { + return strings.MessageTimer_Minutes(max(1, value / 60)) + } else if value < 60 * 60 * 24 { + return strings.MessageTimer_Hours(max(1, value / (60 * 60))) + } else if value < 60 * 60 * 24 * 7 { + return strings.MessageTimer_Days(max(1, value / (60 * 60 * 24))) + } else if value < 60 * 60 * 24 * 30 { + return strings.MessageTimer_Weeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value < 60 * 60 * 24 * 365 { + return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.MessageTimer_Years(max(1, value / (60 * 60 * 24 * 365))) + } } - } else { - if value < 60 { - return strings.MessageTimer_Seconds(max(1, value)) - } else if value < 60 * 60 { - return strings.MessageTimer_Minutes(max(1, value / 60)) - } else if value < 60 * 60 * 24 { - return strings.MessageTimer_Hours(max(1, value / (60 * 60))) - } else if value < 60 * 60 * 24 * 7 { - return strings.MessageTimer_Days(max(1, value / (60 * 60 * 24))) - } else if value < 60 * 60 * 24 * 30 { - return strings.MessageTimer_Weeks(max(1, value / (60 * 60 * 24 * 7))) - } else if value < 60 * 60 * 24 * 365 { - return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30))) + case .afterTime: + if preferLowerValue { + if value <= 60 { + return strings.Time_AfterSeconds(max(1, value)) + } else if value <= 60 * 60 { + return strings.Time_AfterMinutes(max(1, value / 60)) + } else if value <= 60 * 60 * 24 { + return strings.Time_AfterHours(max(1, value / (60 * 60))) + } else if value <= 60 * 60 * 24 * 7 { + return strings.Time_AfterDays(max(1, value / (60 * 60 * 24))) + } else if value <= 60 * 60 * 24 * 30 { + return strings.Time_AfterWeeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value <= 60 * 60 * 24 * 365 { + return strings.Time_AfterMonths(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.Time_AfterYears(max(1, value / (60 * 60 * 24 * 365))) + } } else { - return strings.MessageTimer_Years(max(1, value / (60 * 60 * 24 * 365))) + if value < 60 { + return strings.Time_AfterSeconds(max(1, value)) + } else if value < 60 * 60 { + return strings.Time_AfterMinutes(max(1, value / 60)) + } else if value < 60 * 60 * 24 { + return strings.Time_AfterHours(max(1, value / (60 * 60))) + } else if value < 60 * 60 * 24 * 7 { + return strings.Time_AfterDays(max(1, value / (60 * 60 * 24))) + } else if value < 60 * 60 * 24 * 30 { + return strings.Time_AfterWeeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value < 60 * 60 * 24 * 365 { + return strings.Time_AfterMonths(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.Time_AfterYears(max(1, value / (60 * 60 * 24 * 365))) + } + } + case .timer: + if preferLowerValue { + if value <= 60 { + return strings.Time_TimerSeconds(max(1, value)) + } else if value <= 60 * 60 { + return strings.Time_TimerMinutes(max(1, value / 60)) + } else if value <= 60 * 60 * 24 { + return strings.Time_TimerHours(max(1, value / (60 * 60))) + } else if value <= 60 * 60 * 24 * 7 { + return strings.Time_TimerDays(max(1, value / (60 * 60 * 24))) + } else if value <= 60 * 60 * 24 * 30 { + return strings.Time_TimerWeeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value <= 60 * 60 * 24 * 365 { + return strings.Time_TimerMonths(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.Time_TimerYears(max(1, value / (60 * 60 * 24 * 365))) + } + } else { + if value < 60 { + return strings.Time_TimerSeconds(max(1, value)) + } else if value < 60 * 60 { + return strings.Time_TimerMinutes(max(1, value / 60)) + } else if value < 60 * 60 * 24 { + return strings.Time_TimerHours(max(1, value / (60 * 60))) + } else if value < 60 * 60 * 24 * 7 { + return strings.Time_TimerDays(max(1, value / (60 * 60 * 24))) + } else if value < 60 * 60 * 24 * 30 { + return strings.Time_TimerWeeks(max(1, value / (60 * 60 * 24 * 7))) + } else if value < 60 * 60 * 24 * 365 { + return strings.Time_TimerMonths(max(1, value / (60 * 60 * 24 * 30))) + } else { + return strings.Time_TimerYears(max(1, value / (60 * 60 * 24 * 365))) + } } } } diff --git a/submodules/TelegramUI/Sources/CreateGroupController.swift b/submodules/TelegramUI/Sources/CreateGroupController.swift index 4345038975..e9289fa880 100644 --- a/submodules/TelegramUI/Sources/CreateGroupController.swift +++ b/submodules/TelegramUI/Sources/CreateGroupController.swift @@ -310,16 +310,15 @@ private func createGroupEntries(presentationData: PresentationData, state: Creat entries.append(.groupInfo(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer, groupInfoState, state.avatar)) - //TODO:localize let autoremoveTimeout = state.autoremoveTimeout ?? globalAutoremoveTimeout let autoRemoveText: String if autoremoveTimeout == 0 { - autoRemoveText = "Off" + autoRemoveText = presentationData.strings.Autoremove_OptionOff } else { autoRemoveText = timeIntervalString(strings: presentationData.strings, value: autoremoveTimeout) } - entries.append(.autoDelete(title: "Auto-Delete Messages", value: autoRemoveText)) - entries.append(.autoDeleteInfo("Automatically delete messages sent in this group for everyone after a period of time.")) + entries.append(.autoDelete(title: presentationData.strings.CreateGroup_AutoDeleteTitle, value: autoRemoveText)) + entries.append(.autoDeleteInfo(presentationData.strings.CreateGroup_AutoDeleteText)) var peers: [Peer] = [] for peerId in peerIds { @@ -846,8 +845,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId] } let presentationData = context.sharedContext.currentPresentationData.with { $0 } - //TODO:localize - subItems.append(.action(ContextMenuActionItem(text: "Off", icon: { theme in + subItems.append(.action(ContextMenuActionItem(text: presentationData.strings.Autoremove_OptionOff, icon: { theme in if currentValue == 0 { return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor) } else { @@ -882,8 +880,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId] }))) } - //TODO:localize - subItems.append(.action(ContextMenuActionItem(text: "Set Custom Time...", icon: { _ in + subItems.append(.action(ContextMenuActionItem(text: presentationData.strings.Autoremove_SetCustomTime, icon: { _ in return nil }, action: { _, f in f(.default)