Localization

This commit is contained in:
Ali 2023-08-11 19:46:43 +04:00
parent a91cce0980
commit ca419a42a7
8 changed files with 107 additions and 80 deletions

View File

@ -9798,3 +9798,51 @@ Sorry for the inconvenience.";
"Premium.MaxStoriesMonthlyFinalText" = "You have reached the limit of **%@** stories per month.";
"MediaPicker.Recents" = "Recents";
"Story.LongTapForMoreReactions" = "Long tap for more reactions";
"Story.StealthModeActivePlaceholder" = "Stealth Mode active %@";
"Story.ContextShowStoriesTo" = "Show My Stories To %@";
"Story.ToastShowStoriesTo" = "**%@** will now see your stories.";
"Story.ContextHideStoriesFrom" = "Hide My Stories From %@";
"Story.ToastHideStoriesFrom" = "**%@** will not see your stories anymore.";
"Story.ContextDeleteContact" = "Delete Contact";
"Story.ToastDeletedContact" = "**%@** has been removed from your contacts.";
"Story.ToastUserBlocked" = "**%@** has been blocked.";
"Story.ToastPremiumSaveToGallery" = "Subscribe to [Telegram Premium]() to save other people's unprotected stories to your Gallery.";
"Story.PremiumUpgradeStoriesButton" = "Upgrade Stories";
"Story.ContextStealthMode" = "Stealth Mode";
"Story.AlertStealthModeActiveTitle" = "You are in Stealth Mode now";
"Story.AlertStealthModeActiveText" = "If you send a reply or reaction, the creator of the story will also see you in the list of viewers.";
"Story.AlertStealthModeActiveAction" = "Proceed";
"Story.ToastStealthModeActiveTitle" = "You are in Stealth Mode now";
"Story.ToastStealthModeActiveText" = "The creators of stories you will view in the next **%@** won't see you in the viewers' lists.";
"Story.ToastStealthModeActivatedTitle" = "Stealth Mode On";
"Story.ToastStealthModeActivatedText" = "The creators of stories you viewed in the last **%1$@** or will view in the next **%2$@** wont see you in the viewers lists.";
"Story.ViewList.PremiumUpgradeText" = "List of viewers isn't available after 24 hours of story expiration.\n\nTo unlock viewers' lists for expired and saved stories, subscribe to [Telegram Premium]().";
"Story.ViewList.PremiumUpgradeAction" = "Learn More";
"Story.ViewList.PremiumUpgradeInlineText" = "To unlock viewers' lists for expired and saved stories, subscribe to [Telegram Premium]().";
"Story.ViewList.EmptyTextSearch" = "No views found";
"Story.ViewList.EmptyTextContacts" = "None of your contacts viewed this story.";
"Story.ViewList.ContextSortReactions" = "Reactions First";
"Story.ViewList.ContextSortRecent" = "Recent First";
"Story.ViewList.ContextSortInfo" = "Choose the order for the list of viewers.";
"Story.ViewList.TabTitleAll" = "All Viewers";
"Story.ViewList.TabTitleContacts" = "Contacts";
"Story.ViewList.TitleViewers" = "Viewers";
"Story.ViewList.TitleEmpty" = "No Views";
"Story.Footer.NoViews" = "No Views";
"Story.Footer.ViewCount_1" = " %d View";
"Story.Footer.ViewCount_any" = " %d Views";
"Story.StealthMode.Title" = "Stealth Mode";
"Story.StealthMode.ControlText" = "Turn Stealth Mode on to hide the fact that you viewed peoples' stories from them.";
"Story.StealthMode.UpgradeText" = "Subscribe to Telegram Premium to hide the fact that you viewed peoples' stories from them.";
"Story.StealthMode.RecentTitle" = "Hide Recent Views";
"Story.StealthMode.RecentText" = "Hide my views in the last **%@**.";
"Story.StealthMode.NextTitle" = "Hide Next Views";
"Story.StealthMode.NextText" = "Hide my views in the next **%@**.";
"Story.StealthMode.ToastCooldownText" = "Please wait until the **Stealth Mode** is ready to use again";
"Story.StealthMode.EnableAction" = "Enable Stealth Mode";
"Story.StealthMode.CooldownAction" = "Available in %@";
"Story.StealthMode.UpgradeAction" = "Unlock Stealth Mode";

View File

@ -26,6 +26,7 @@ public final class NavigationSearchComponent: Component {
}
public let colors: Colors
public let cancel: String
public let placeholder: String
public let isSearchActive: Bool
public let collapseFraction: CGFloat
@ -35,6 +36,7 @@ public final class NavigationSearchComponent: Component {
public init(
colors: Colors,
cancel: String,
placeholder: String,
isSearchActive: Bool,
collapseFraction: CGFloat,
@ -43,6 +45,7 @@ public final class NavigationSearchComponent: Component {
updateQuery: @escaping (String) -> Void
) {
self.colors = colors
self.cancel = cancel
self.placeholder = placeholder
self.isSearchActive = isSearchActive
self.collapseFraction = collapseFraction
@ -55,6 +58,9 @@ public final class NavigationSearchComponent: Component {
if lhs.colors != rhs.colors {
return false
}
if lhs.cancel != rhs.cancel {
return false
}
if lhs.placeholder != rhs.placeholder {
return false
}
@ -189,11 +195,10 @@ public final class NavigationSearchComponent: Component {
self.button = button
}
//TODO:localize
let buttonSize = button.update(
transition: buttonTransition,
component: AnyComponent(Button(
content: AnyComponent(Text(text: "Cancel", font: Font.regular(17.0), color: component.colors.button)),
content: AnyComponent(Text(text: component.cancel, font: Font.regular(17.0), color: component.colors.button)),
action: { [weak self] in
guard let self, let component = self.component else {
return

View File

@ -2240,11 +2240,10 @@ public final class StoryItemSetContainerComponent: Component {
return
}
//TODO:localize
let tooltipScreen = TooltipScreen(
account: component.context.account,
sharedContext: component.context.sharedContext,
text: .markdown(text: "Long tap for more reactions"),
text: .markdown(text: component.strings.Story_LongTapForMoreReactions),
balancedTextLayout: true,
style: .customBlur(component.theme.rootController.navigationBar.blurredBackgroundColor, 0.0),
arrowStyle: .small,
@ -2426,8 +2425,7 @@ public final class StoryItemSetContainerComponent: Component {
let inputPlaceholder: String
if let stealthModeTimeout = component.stealthModeTimeout {
//TODO:localize
inputPlaceholder = "Stealth Mode active \(stringForDuration(stealthModeTimeout))"
inputPlaceholder = component.strings.Story_StealthModeActivePlaceholder("\(stringForDuration(stealthModeTimeout))").string
} else {
inputPlaceholder = component.strings.Story_InputPlaceholderReplyPrivately
}
@ -2961,7 +2959,7 @@ public final class StoryItemSetContainerComponent: Component {
}
if isBlockedFromStories {
itemList.append(.action(ContextMenuActionItem(text: "Show My Stories To \(peer.compactDisplayTitle)", icon: { theme in
itemList.append(.action(ContextMenuActionItem(text: component.strings.Story_ContextShowStoriesTo(peer.compactDisplayTitle).string, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Stories"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.default)
@ -2975,7 +2973,7 @@ public final class StoryItemSetContainerComponent: Component {
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
self.component?.presentController(UndoOverlayController(
presentationData: presentationData,
content: .info(title: nil, text: "**\(peer.compactDisplayTitle)** will now see your stories.", timeout: nil),
content: .info(title: nil, text: component.strings.Story_ToastShowStoriesTo(peer.compactDisplayTitle).string, timeout: nil),
elevatedLayout: false,
position: .top,
animateInAsReplacement: false,
@ -2984,7 +2982,7 @@ public final class StoryItemSetContainerComponent: Component {
), nil)
})))
} else {
itemList.append(.action(ContextMenuActionItem(text: "Hide My Stories From \(peer.compactDisplayTitle)", icon: { theme in
itemList.append(.action(ContextMenuActionItem(text: component.strings.Story_ContextHideStoriesFrom(peer.compactDisplayTitle).string, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Stories"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.default)
@ -2996,7 +2994,7 @@ public final class StoryItemSetContainerComponent: Component {
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
self.component?.presentController(UndoOverlayController(
presentationData: presentationData,
content: .info(title: nil, text: "**\(peer.compactDisplayTitle)** will not see your stories anymore.", timeout: nil),
content: .info(title: nil, text: component.strings.Story_ToastHideStoriesFrom(peer.compactDisplayTitle).string, timeout: nil),
elevatedLayout: false,
position: .top,
animateInAsReplacement: false,
@ -3007,8 +3005,7 @@ public final class StoryItemSetContainerComponent: Component {
}
if isContact {
//TODO:localize
itemList.append(.action(ContextMenuActionItem(text: "Delete Contact", textColor: .destructive, icon: { theme in
itemList.append(.action(ContextMenuActionItem(text: component.strings.Story_ContextDeleteContact, textColor: .destructive, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
}, action: { [weak self] _, f in
f(.default)
@ -3030,8 +3027,8 @@ public final class StoryItemSetContainerComponent: Component {
"info2.info2.Fill": animationBackgroundColor
],
title: nil,
text: "**\(peer.compactDisplayTitle)** has been removed from your contacts.",
customUndoText: "Undo",
text: component.strings.Story_ToastDeletedContact(peer.compactDisplayTitle).string,
customUndoText: component.strings.Undo_Undo,
timeout: nil
),
elevatedLayout: false,
@ -3077,8 +3074,8 @@ public final class StoryItemSetContainerComponent: Component {
"info2.info2.Fill": animationBackgroundColor
],
title: nil,
text: "**\(peer.compactDisplayTitle)** has been blocked.",
customUndoText: "Undo",
text: component.strings.Story_ToastUserBlocked(peer.compactDisplayTitle).string,
customUndoText: component.strings.Undo_Undo,
timeout: nil
),
elevatedLayout: false,
@ -4813,7 +4810,6 @@ public final class StoryItemSetContainerComponent: Component {
self.dismissAllTooltips()
//TODO:localize
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
let animationBackgroundColor = presentationData.theme.rootController.tabBar.backgroundColor
component.presentController(UndoOverlayController(
@ -4826,7 +4822,7 @@ public final class StoryItemSetContainerComponent: Component {
"info2.info2.Fill": animationBackgroundColor
],
title: nil,
text: "Subscribe to [Telegram Premium]() to save other people's unprotected stories to your Gallery.",
text: component.strings.Story_ToastPremiumSaveToGallery,
customUndoText: nil,
timeout: nil
),
@ -4864,9 +4860,8 @@ public final class StoryItemSetContainerComponent: Component {
}
let context = component.context
//TODO:localize
var replaceImpl: ((ViewController) -> Void)?
let controller = PremiumLimitsListScreen(context: context, subject: .stories, source: .other, order: [.stories], buttonText: "Upgrade Stories", isPremium: false, forceDark: true)
let controller = PremiumLimitsListScreen(context: context, subject: .stories, source: .other, order: [.stories], buttonText: component.strings.Story_PremiumUpgradeStoriesButton, isPremium: false, forceDark: true)
controller.action = { [weak self] in
guard let self else {
return
@ -5294,8 +5289,7 @@ public final class StoryItemSetContainerComponent: Component {
})))
if case let .user(accountUser) = component.slice.peer {
//TODO:localize
items.append(.action(ContextMenuActionItem(text: "Stealth Mode", icon: { theme in
items.append(.action(ContextMenuActionItem(text: component.strings.Story_ContextStealthMode, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: accountUser.isPremium ? "Chat/Context Menu/Eye" : "Chat/Context Menu/EyeLocked"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, a in
a(.default)
@ -5526,8 +5520,7 @@ public final class StoryItemSetContainerComponent: Component {
})))
}
//TODO:localize
items.append(.action(ContextMenuActionItem(text: "Stealth Mode", icon: { theme in
items.append(.action(ContextMenuActionItem(text: component.strings.Story_ContextStealthMode, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: accountUser.isPremium ? "Chat/Context Menu/Eye" : "Chat/Context Menu/EyeLocked"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, a in
a(.default)

View File

@ -508,15 +508,14 @@ final class StoryItemSetContainerSendMessage {
let theme = component.theme
let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>) = (component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: theme), component.context.sharedContext.presentationData |> map { $0.withUpdated(theme: theme) })
//TODO:localize
let alertController = textAlertController(
context: component.context,
updatedPresentationData: updatedPresentationData,
title: "You are in Stealth Mode now",
text: "If you send a reply or reaction, the creator of the story will also see you in the list of viewers.",
title: component.strings.Story_AlertStealthModeActiveTitle,
text: component.strings.Story_AlertStealthModeActiveText,
actions: [
TextAlertAction(type: .defaultAction, title: "Cancel", action: {}),
TextAlertAction(type: .genericAction, title: "Proceed", action: {
TextAlertAction(type: .defaultAction, title: component.strings.Common_Cancel, action: {}),
TextAlertAction(type: .genericAction, title: component.strings.Story_AlertStealthModeActiveAction, action: {
action()
})
]
@ -3074,11 +3073,10 @@ final class StoryItemSetContainerSendMessage {
let remainingActiveSeconds = activeUntilTimestamp - timestamp
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkPresentationTheme)
//TODO:localize
let text = "The creators of stories you will view in the next **\(timeIntervalString(strings: presentationData.strings, value: remainingActiveSeconds))** won't see you in the viewers' lists."
let text = component.strings.Story_ToastStealthModeActiveText(timeIntervalString(strings: presentationData.strings, value: remainingActiveSeconds)).string
let tooltipScreen = UndoOverlayController(
presentationData: presentationData,
content: .actionSucceeded(title: "You are in Stealth Mode", text: text, cancel: "", destructive: false),
content: .actionSucceeded(title: component.strings.Story_ToastStealthModeActiveTitle, text: text, cancel: "", destructive: false),
elevatedLayout: false,
animateInAsReplacement: false,
action: { _ in
@ -3102,9 +3100,8 @@ final class StoryItemSetContainerSendMessage {
let remainingActiveSeconds = max(1, activeUntilTimestamp - timestamp)
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkPresentationTheme)
//TODO:localize
let text = "The creators of stories you will view in the next **\(timeIntervalString(strings: presentationData.strings, value: remainingActiveSeconds))** won't see you in the viewers' lists."
tooltipScreenValue.content = .actionSucceeded(title: "You are in Stealth Mode", text: text, cancel: "", destructive: false)
let text = component.strings.Story_ToastStealthModeActiveText(timeIntervalString(strings: presentationData.strings, value: remainingActiveSeconds)).string
tooltipScreenValue.content = .actionSucceeded(title: component.strings.Story_ToastStealthModeActiveTitle, text: text, cancel: "", destructive: false)
})
self.tooltipScreen?.dismiss(animated: true)
@ -3143,11 +3140,10 @@ final class StoryItemSetContainerSendMessage {
}
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkPresentationTheme)
//TODO:localize
let text = "The creators of stories you viewed in the last \(timeIntervalString(strings: presentationData.strings, value: pastPeriod)) or will view in the next **\(timeIntervalString(strings: presentationData.strings, value: futurePeriod))** wont see you in the viewers lists."
let text = component.strings.Story_ToastStealthModeActivatedText(timeIntervalString(strings: presentationData.strings, value: pastPeriod), timeIntervalString(strings: presentationData.strings, value: futurePeriod)).string
let tooltipScreen = UndoOverlayController(
presentationData: presentationData,
content: .actionSucceeded(title: "Stealth Mode On", text: text, cancel: "", destructive: false),
content: .actionSucceeded(title: component.strings.Story_ToastStealthModeActivatedTitle, text: text, cancel: "", destructive: false),
elevatedLayout: false,
animateInAsReplacement: false,
action: { _ in

View File

@ -768,8 +768,7 @@ final class StoryItemSetViewListComponent: Component {
let link = MarkdownAttributeSet(font: Font.semibold(fontSize), textColor: component.theme.list.itemAccentColor)
let attributes = MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { _ in return ("URL", "") })
//TODO:localize
let text = "To unlock viewers' lists for expired and saved stories, subscribe to [Telegram Premium]()."
let text = component.strings.Story_ViewList_PremiumUpgradeInlineText
premiumFooterSize = premiumFooterText.update(
transition: .immediate,
component: AnyComponent(BalancedTextComponent(
@ -897,25 +896,22 @@ final class StoryItemSetViewListComponent: Component {
if emptyButton == nil {
text = component.strings.Story_Views_ViewsExpired
} else {
//TODO:localize
text = "List of viewers isn't available after 24 hours of story expiration.\n\nTo unlock viewers' lists for expired and saved stories, subscribe to [Telegram Premium]()."
text = component.strings.Story_ViewList_PremiumUpgradeText
}
} else {
text = component.strings.Story_Views_NoViews
}
} else {
//TODO:localize
if let query = self.query, !query.isEmpty {
text = "No views found"
text = component.strings.Story_ViewList_EmptyTextSearch
} else if self.configuration.listMode == .contacts {
text = "None of your contacts viewed this story."
text = component.strings.Story_ViewList_EmptyTextContacts
} else {
if component.storyItem.expirationTimestamp <= Int32(Date().timeIntervalSince1970) {
if emptyButton == nil {
text = component.strings.Story_Views_ViewsExpired
} else {
//TODO:localize
text = "List of viewers isn't available after 24 hours of story expiration.\n\nTo unlock viewers' lists for expired and saved stories, subscribe to [Telegram Premium]()."
text = component.strings.Story_ViewList_PremiumUpgradeText
}
} else {
text = component.strings.Story_Views_NoViews
@ -952,7 +948,6 @@ final class StoryItemSetViewListComponent: Component {
var emptyButtonSize: CGSize?
if let emptyButton {
//TODO:localize
emptyButtonSize = emptyButton.update(
transition: emptyButtonTransition,
component: AnyComponent(ButtonComponent(
@ -964,7 +959,7 @@ final class StoryItemSetViewListComponent: Component {
content: AnyComponentWithIdentity(
id: AnyHashable(0),
component: AnyComponent(ButtonTextContentComponent(
text: "Learn More",
text: component.strings.Story_ViewList_PremiumUpgradeAction,
badge: 0,
textColor: component.theme.list.itemCheckColors.foregroundColor,
badgeBackground: component.theme.list.itemCheckColors.foregroundColor,
@ -1148,10 +1143,9 @@ final class StoryItemSetViewListComponent: Component {
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
var items: [ContextMenuItem] = []
//TODO:localize
let sortMode = self.sortMode
items.append(.action(ContextMenuActionItem(text: "Reactions First", icon: { theme in
items.append(.action(ContextMenuActionItem(text: component.strings.Story_ViewList_ContextSortReactions, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reactions"), color: theme.contextMenu.primaryColor)
}, additionalLeftIcon: { theme in
if sortMode != .reactionsFirst {
@ -1169,7 +1163,7 @@ final class StoryItemSetViewListComponent: Component {
self.state?.updated(transition: .immediate)
}
})))
items.append(.action(ContextMenuActionItem(text: "Recent First", icon: { theme in
items.append(.action(ContextMenuActionItem(text: component.strings.Story_ViewList_ContextSortRecent, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Time"), color: theme.contextMenu.primaryColor)
}, additionalLeftIcon: { theme in
if sortMode != .recentFirst {
@ -1190,9 +1184,8 @@ final class StoryItemSetViewListComponent: Component {
items.append(.separator)
//TODO:localize
let emptyAction: ((ContextMenuActionItem.Action) -> Void)? = nil
items.append(.action(ContextMenuActionItem(text: "Choose the order for the list of viewers.", textLayout: .multiline, textFont: .small, icon: { _ in return nil }, action: emptyAction)))
items.append(.action(ContextMenuActionItem(text: component.strings.Story_ViewList_ContextSortInfo, textLayout: .multiline, textFont: .small, icon: { _ in return nil }, action: emptyAction)))
let contextItems = ContextController.Items(content: .list(items))
@ -1233,7 +1226,6 @@ final class StoryItemSetViewListComponent: Component {
let visualHeight: CGFloat = max(component.minHeight, component.effectiveHeight)
//TODO:localize
let tabSelectorSize = self.tabSelector.update(
transition: transition,
component: AnyComponent(TabSelectorComponent(
@ -1244,11 +1236,11 @@ final class StoryItemSetViewListComponent: Component {
items: [
TabSelectorComponent.Item(
id: AnyHashable(ListMode.everyone.rawValue),
title: "All Viewers"
title: component.strings.Story_ViewList_TabTitleAll
),
TabSelectorComponent.Item(
id: AnyHashable(ListMode.contacts.rawValue),
title: "Contacts"
title: component.strings.Story_ViewList_TabTitleContacts
)
],
selectedId: AnyHashable(self.listMode == .everyone ? 0 : 1),
@ -1266,16 +1258,15 @@ final class StoryItemSetViewListComponent: Component {
containerSize: CGSize(width: availableSize.width - 10.0 * 2.0, height: 50.0)
)
//TODO:localize
let titleText: String
if let views = component.storyItem.views, views.seenCount != 0 {
if component.storyItem.expirationTimestamp <= Int32(Date().timeIntervalSince1970) {
titleText = component.strings.Story_Footer_Views(Int32(views.seenCount))
} else {
titleText = "Viewers"
titleText = component.strings.Story_ViewList_TitleViewers
}
} else {
titleText = "No Views"
titleText = component.strings.Story_ViewList_TitleEmpty
}
let titleSize = self.title.update(
@ -1314,6 +1305,7 @@ final class StoryItemSetViewListComponent: Component {
foreground: .white,
button: component.theme.rootController.navigationBar.accentTextColor
),
cancel: component.strings.Common_Cancel,
placeholder: component.strings.Common_Search,
isSearchActive: component.isSearchActive,
collapseFraction: 1.0,

View File

@ -302,7 +302,6 @@ public final class StoryFooterPanelComponent: Component {
self.viewStatsButton.isEnabled = viewCount != 0
//TODO:localize
var regularSegments: [AnimatedCountLabelView.Segment] = []
if viewCount != 0 {
regularSegments.append(.number(viewCount, NSAttributedString(string: "\(viewCount)", font: Font.regular(15.0), textColor: .white)))
@ -310,11 +309,9 @@ public final class StoryFooterPanelComponent: Component {
let viewPart: String
if viewCount == 0 {
viewPart = "No Views"
} else if viewCount == 1 {
viewPart = " View"
viewPart = component.strings.Story_Footer_NoViews
} else {
viewPart = " Views"
viewPart = component.strings.Story_Footer_ViewCount(Int32(viewCount))
}
let viewStatsTextLayout = self.viewStatsCountText.update(size: CGSize(width: availableSize.width, height: size.height), segments: regularSegments, transition: isFirstTime ? .immediate : ContainedViewLayoutTransition.animated(duration: 0.25, curve: .easeInOut))

View File

@ -139,8 +139,7 @@ public final class StoryStealthModeInfoContentComponent: Component {
contentHeight += 15.0
let titleString = NSMutableAttributedString()
//TODO:localize
titleString.append(NSAttributedString(string: "Stealth Mode", font: Font.semibold(19.0), textColor: component.theme.list.itemPrimaryTextColor))
titleString.append(NSAttributedString(string: component.strings.Story_StealthMode_Title, font: Font.semibold(19.0), textColor: component.theme.list.itemPrimaryTextColor))
let imageAttachment = NSTextAttachment()
imageAttachment.image = self.iconBackground.image
titleString.append(NSAttributedString(attachment: imageAttachment))
@ -163,13 +162,12 @@ public final class StoryStealthModeInfoContentComponent: Component {
contentHeight += titleSize.height
contentHeight += 15.0
//TODO:localize
let text: String
switch component.mode {
case .control:
text = "Turn Stealth Mode on to hide the fact that you viewed peoples' stories from them."
text = component.strings.Story_StealthMode_ControlText
case .upgrade:
text = "Subscribe to Telegram Premium to hide the fact that you viewed peoples' stories from them."
text = component.strings.Story_StealthMode_UpgradeText
}
let mainText = NSMutableAttributedString()
mainText.append(parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(
@ -216,17 +214,16 @@ public final class StoryStealthModeInfoContentComponent: Component {
var title: String
var text: String
}
//TODO:localize
let itemDescs: [ItemDesc] = [
ItemDesc(
icon: "Stories/StealthModeIntroIconHidePrevious",
title: "Hide Recent Views",
text: "Hide my views in the last **\(timeIntervalString(strings: component.strings, value: component.backwardDuration))**."
title: component.strings.Story_StealthMode_RecentTitle,
text: component.strings.Story_StealthMode_RecentText(timeIntervalString(strings: component.strings, value: component.backwardDuration)).string
),
ItemDesc(
icon: "Stories/StealthModeIntroIconHideNext",
title: "Hide Next Views",
text: "Hide my views in the next **\(timeIntervalString(strings: component.strings, value: component.forwardDuration))**."
title: component.strings.Story_StealthMode_NextTitle,
text: component.strings.Story_StealthMode_NextText(timeIntervalString(strings: component.strings, value: component.forwardDuration)).string
)
]
for i in 0 ..< itemDescs.count {

View File

@ -137,7 +137,6 @@ private final class StoryStealthModeSheetContentComponent: Component {
toast = ComponentView()
self.toast = toast
}
//TODO:localize
let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white)
let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white)
let toastSize = toast.update(
@ -149,7 +148,7 @@ private final class StoryStealthModeSheetContentComponent: Component {
size: CGSize(width: 32.0, height: 32.0)
)),
content: AnyComponent(MultilineTextComponent(
text: .markdown(text: "Please wait until the **Stealth Mode** is ready to use again", attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil })),
text: .markdown(text: environment.strings.Story_StealthMode_ToastCooldownText, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil })),
maximumNumberOfLines: 0
))
)),
@ -247,13 +246,13 @@ private final class StoryStealthModeSheetContentComponent: Component {
switch component.mode {
case .control:
if remainingCooldownSeconds <= 0 {
buttonText = "Enable Stealth Mode"
buttonText = environment.strings.Story_StealthMode_EnableAction
} else {
buttonText = "Available in \(stringForDuration(remainingCooldownSeconds))"
buttonText = environment.strings.Story_StealthMode_CooldownAction(stringForDuration(remainingCooldownSeconds)).string
}
content = AnyComponentWithIdentity(id: AnyHashable(0 as Int), component: AnyComponent(Text(text: buttonText, font: Font.semibold(17.0), color: environment.theme.list.itemCheckColors.foregroundColor)))
case .upgrade:
buttonText = "Unlock Stealth Mode"
buttonText = environment.strings.Story_StealthMode_UpgradeAction
content = AnyComponentWithIdentity(id: AnyHashable(1 as Int), component: AnyComponent(
HStack([
AnyComponentWithIdentity(id: AnyHashable(1 as Int), component: AnyComponent(Text(text: buttonText, font: Font.semibold(17.0), color: environment.theme.list.itemCheckColors.foregroundColor))),