Update localization

This commit is contained in:
Ilya Laktyushin 2024-09-27 00:07:33 +04:00
parent 23fa85770d
commit 7a0f7adb22
13 changed files with 222 additions and 85 deletions

View File

@ -12948,3 +12948,106 @@ Sorry for the inconvenience.";
"SharedMedia.GiftCount_1" = "%@ gift";
"SharedMedia.GiftCount_any" = "%@ gifts";
"Stars.Info.Title" = "What are Stars?";
"Stars.Info.Description" = "Buy packages of Stars on Telegram that let you do following:";
"Stars.Info.Gift.Title" = "Send Gifts to Friends";
"Stars.Info.Gift.Text" = "Give your friends gifts that can be kept on their profiles or converted to Stars.";
"Stars.Info.Miniapp.Title" = "Use Stars in Miniapps";
"Stars.Info.Miniapp.Text" = "Buy additional content and services in Telegram miniapps. [See Examples >]()";
"Stars.Info.Media.Title" = "Unlock Content in Channels";
"Stars.Info.Media.Text" = "Get access to paid content and services in Telegram channels.";
"Stars.Info.Reaction.Title" = "Send Star Reactions";
"Stars.Info.Reaction.Text" = "Support your favorite channels by sending Star reactions to their posts.";
"Stars.Info.Done" = "Got It";
"Gift.View.Title" = "Gift";
"Gift.View.ReceivedTitle" = "Received Gift";
"Gift.View.KeepOrConvertDescription" = "You can keep this gift in your Profile or convert it to %@. [More About Stars >]()";
"Gift.View.KeepOrConvertDescription.Stars_1" = "%@ Star";
"Gift.View.KeepOrConvertDescription.Stars_any" = "%@ Stars";
"Gift.View.ConvertedDescription" = "You converted this gift to %@. [More About Stars >]()";
"Gift.View.ConvertedDescription.Stars_1" = "%@ Star";
"Gift.View.ConvertedDescription.Stars_any" = "%@ Stars";
"Gift.View.OtherDescription" = "%1$@ can keep this gift in their Profile or convert it to %2$@. [More About Stars >]()";
"Gift.View.OtherDescription.Stars_1" = "%@ Star";
"Gift.View.OtherDescription.Stars_any" = "%@ Stars";
"Gift.View.From" = "From";
"Gift.View.HiddenName" = "Hidden Name";
"Gift.View.Date" = "Date";
"Gift.View.Availability" = "Availability";
"Gift.View.Hide" = "Hide from My Page";
"Gift.View.Display" = "Display on My Page";
"Gift.View.Convert" = "Convert to %@";
"Gift.View.Convert.Stars_1" = "%@ Star";
"Gift.View.Convert.Stars_any" = "%@ Stars";
"Gift.Displayed.Title" = "Gift Saved to Profile";
"Gift.Displayed.Text" = "The gift is now displayed in [your profile]().";
"Gift.Hidden.Title" = "Gift Removed from Profile";
"Gift.Hidden.Text" = "The gift is no longer displayed in [your profile]().";
"Gift.Convert.Title" = "Convert Gift to Stars";
"Gift.Convert.Text" = "Do you want to convert this gift from **%1$@** to **%2$@**?\n\nThis action cannot be undone.";
"Gift.Convert.Stars_1" = "%@ Star";
"Gift.Convert.Stars_any" = "%@ Stars";
"Gift.Convert.Convert" = "Convert";
"Gift.Convert.Success.Title" = "Gift Converted";
"Gift.Convert.Success.Text" = "You received **%1$@** instead.";
"Gift.Convert.Success.Text.Stars_1" = "%@ Star";
"Gift.Convert.Success.Text.Stars_any" = "%@ Stars";
"Gift.Options.Premium.Title" = "Gift Premium";
"Gift.Options.Premium.Text" = "Give **%@** access to exclusive features with Telegram Premium. [See Features >]()";
"Gift.Options.Premium.Months_1" = "%@ month";
"Gift.Options.Premium.Months_any" = "%@ months";
"Gift.Options.Premium.Years_1" = "%@ year";
"Gift.Options.Premium.Years_any" = "%@ years";
"Gift.Options.Premium.Premium" = "Premium";
"Gift.Options.Gift.Title" = "Send a Gift";
"Gift.Options.Gift.Text" = "Give **%@** gifts that can be kept on the profile or converted to Stars. [What are Stars >]()";
"Gift.Options.Gift.Filter.AllGifts" = "All Gifts";
"Gift.Options.Gift.Filter.Limited" = "Limited";
"Gift.Options.Gift.Limited" = "Limited";
"PeerInfo.PaneGifts" = "Gifts";
"PeerInfo.Gifts.Info" = "These gifts were sent to you by other users. Tap on a gift to exchange it for Stars or change its privacy settings.";
"PeerInfo.Gifts.Send" = "Send Gifts to Friends";
"PeerInfo.Gifts.OneOf" = "1 of %@";
"Notification.StarGift.Title" = "Gift from %@";
"Notification.StarGift.Subtitle" = "Display this gift on your page or convert it to %@.";
"Notification.StarGift.Subtitle.Stars_1" = "%@ Star";
"Notification.StarGift.Subtitle.Stars_any" = "%@ Stars";
"Notification.StarGift.Subtitle.Other" = "%1$@ can keep this gift on their page or convert it to %2$@.";
"Notification.StarGift.Subtitle.Other.Stars_1" = "%@ Star";
"Notification.StarGift.Subtitle.Other.Stars_any" = "%@ Stars";
"Notification.StarGift.Subtitle.Converted" = "You converted this gift to %@.";
"Notification.StarGift.Subtitle.Converted.Stars_1" = "%@ Star";
"Notification.StarGift.Subtitle.Converted.Stars_any" = "%@ Stars";
"Notification.StarGift.Subtitle.Displaying" = "You are displaying this gift on your page. You can also convert it to %@.";
"Notification.StarGift.Subtitle.Displaying.Stars_1" = "%@ Star";
"Notification.StarGift.Subtitle.Displaying.Stars_any" = "%@ Stars";
"Notification.StarGift.OneOf" = "1 of %@";
"Notification.StarGift.View" = "View";
"Gift.Send.Title" = "Send a Gift";
"Gift.Send.Customize.Title" = "CUSTOMIZE YOUR GIFT";
"Gift.Send.Customize.MessagePlaceholder" = "Enter Message";
"Gift.Send.HideMyName" = "Hide My Name";
"Gift.Send.HideMyName.Info" = "Hide my name and message from visitors to %1$@'s profile. %2$@ will still see your name and message.";
"Gift.Send.Send" = "Send a Gift for";
"Profile.SendGift" = "Send a Gift";
"Settings.SendGift" = "Send a Gift";
"Gift.PremiumOrStars.Title" = "Gift Premium or Stars";
"Report.Title.Message" = "Report Message";
"Report.Title.Story" = "Report Story";
"Report.Title.User" = "Report User";
"Report.Title.Group" = "Report Group";
"Report.Title.Channel" = "Report Channel";
"Report.Comment.Placeholder" = "Add Comment";
"Report.Comment.Placeholder.Optional" = "Add Comment (Optional)";
"Report.Comment.Info" = "Please help us by telling what is wrong with the message you have selected.";
"Report.Send" = "Send Report";

View File

@ -1169,8 +1169,7 @@ public class BrowserScreen: ViewController, MinimizableController {
} else {
items.append(.custom(fontItem, false))
//TODO:localize
if case .webPage = contentState.contentType {
let isAvailable = contentState.hasInstantView
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.WebBrowser_ShowInstantView, textColor: isAvailable ? .primary : .disabled, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Boost"), color: isAvailable ? theme.contextMenu.primaryColor : theme.contextMenu.primaryColor.withAlphaComponent(0.3)) }, action: isAvailable ? { (controller, action) in

View File

@ -25,7 +25,7 @@ public enum ReportContentSubject: Equatable {
case messages([EngineMessage.Id])
case stories(EnginePeer.Id, [Int32])
var peerId: EnginePeer.Id {
public var peerId: EnginePeer.Id {
switch self {
case let .peer(peerId):
return peerId

View File

@ -343,23 +343,19 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
hasServiceMessage = false
}
case let .starGift(gift, convertStars, giftText, giftEntities, _, savedToProfile, converted):
//TODO:localize
if !incoming {
buttonTitle = ""
}
let authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
title = "Gift from \(authorName)"
title = item.presentationData.strings.Notification_StarGift_Title(authorName).string
if let giftText, !giftText.isEmpty {
text = giftText
entities = giftEntities ?? []
} else {
if incoming {
if converted {
text = "You converted this gift to \(convertStars) Stars."
text = item.presentationData.strings.Notification_StarGift_Subtitle_Converted(item.presentationData.strings.Notification_StarGift_Subtitle_Converted_Stars(Int32(convertStars))).string
} else if savedToProfile {
text = "You are displaying this gift on your page. You can also convert it to \(convertStars) Stars."
text = item.presentationData.strings.Notification_StarGift_Subtitle_Displaying(item.presentationData.strings.Notification_StarGift_Subtitle_Displaying_Stars(Int32(convertStars))).string
} else {
text = "Display this gift on your page or convert it to \(convertStars) Stars."
text = item.presentationData.strings.Notification_StarGift_Subtitle(item.presentationData.strings.Notification_StarGift_Subtitle_Stars(Int32(convertStars))).string
}
} else {
var peerName = ""
@ -367,15 +363,26 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
peerName = EnginePeer(peer).compactDisplayTitle
}
if peerName.isEmpty {
text = "Display this gift on your page or convert it to \(convertStars) Stars."
text = item.presentationData.strings.Notification_StarGift_Subtitle(item.presentationData.strings.Notification_StarGift_Subtitle_Stars(Int32(convertStars))).string
} else {
text = "\(peerName) can keep this gift on their page or convert it to \(convertStars) Stars."
text = item.presentationData.strings.Notification_StarGift_Subtitle_Other(peerName, item.presentationData.strings.Notification_StarGift_Subtitle_Other_Stars(Int32(convertStars))).string
}
}
}
animationFile = gift.file
if let availability = gift.availability {
ribbonTitle = "1 of \(availability.total)"
let availabilityString: String
if availability.total > 9999 {
availabilityString = compactNumericCountString(Int(availability.total))
} else {
availabilityString = "\(availability.total)"
}
ribbonTitle = item.presentationData.strings.Notification_StarGift_OneOf(availabilityString).string
}
if incoming {
buttonTitle = item.presentationData.strings.Notification_StarGift_View
} else {
buttonTitle = ""
}
default:
break

View File

@ -111,6 +111,8 @@ private final class SheetPageContent: CombinedComponent {
let section = Child(ListSectionComponent.self)
let button = Child(ButtonComponent.self)
let textInputTag = NSObject()
return { context in
let environment = context.environment[EnvironmentType.self]
let component = context.component
@ -238,7 +240,7 @@ private final class SheetPageContent: CombinedComponent {
strings: strings,
initialText: "",
resetText: nil,
placeholder: isOptional ? "Add Comment (Optional)" : "Add Comment",
placeholder: isOptional ? strings.Report_Comment_Placeholder_Optional : strings.Report_Comment_Placeholder,
autocapitalizationType: .none,
autocorrectionType: .no,
returnKeyType: .done,
@ -257,13 +259,13 @@ private final class SheetPageContent: CombinedComponent {
// }
},
textUpdateTransition: .spring(duration: 0.4),
tag: nil
tag: textInputTag
)))
)
footer = AnyComponent(MultilineTextComponent(
text: .plain(
NSAttributedString(string: "Please help us by telling what is wrong with the message you have selected.", font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: theme.list.freeTextColor)
NSAttributedString(string: strings.Report_Comment_Info, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: theme.list.freeTextColor)
),
maximumNumberOfLines: 0
))
@ -305,7 +307,7 @@ private final class SheetPageContent: CombinedComponent {
foreground: theme.list.itemCheckColors.foregroundColor,
pressedColor: theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.8)
),
content: AnyComponentWithIdentity(id: AnyHashable(0 as Int), component: AnyComponent(Text(text: "Send Report", font: Font.semibold(17.0), color: theme.list.itemCheckColors.foregroundColor))),
content: AnyComponentWithIdentity(id: AnyHashable(0 as Int), component: AnyComponent(Text(text: strings.Report_Send, font: Font.semibold(17.0), color: theme.list.itemCheckColors.foregroundColor))),
isEnabled: isOptional || state.textInputState.hasText,
allowActionWhenDisabled: false,
displaysProgress: false,
@ -400,13 +402,27 @@ private final class SheetContent: CombinedComponent {
var pushedOptions: [(title: String, subtitle: String, content: SheetPageContent.Content)] = []
let disposable = MetaDisposable()
var peer: EnginePeer?
private var peerDisposable: Disposable?
init(context: AccountContext, subject: ReportContentSubject) {
super.init()
self.peerDisposable = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: subject.peerId))
|> deliverOnMainQueue).start(next: { [weak self] peer in
self?.peer = peer
self?.updated()
})
}
deinit {
self.disposable.dispose()
self.peerDisposable?.dispose()
}
}
func makeState() -> State {
return State()
return State(context: self.context, subject: self.subject)
}
static var body: Body {
@ -451,11 +467,21 @@ private final class SheetContent: CombinedComponent {
let mainTitle: String
switch component.subject {
case .peer:
mainTitle = "Report Peer"
if let peer = state.peer {
if case .user = peer {
mainTitle = environment.strings.Report_Title_User
} else if case let .channel(channel) = peer, case .broadcast = channel.info {
mainTitle = environment.strings.Report_Title_Channel
} else {
mainTitle = environment.strings.Report_Title_Group
}
} else {
mainTitle = ""
}
case .messages:
mainTitle = "Report Message"
mainTitle = environment.strings.Report_Title_Message
case .stories:
mainTitle = "Report Story"
mainTitle = environment.strings.Report_Title_Story
}
var items: [AnyComponentWithIdentity<EnvironmentType>] = []

View File

@ -287,7 +287,7 @@ final class GiftOptionsScreenComponent: Component {
price: "⭐️ \(gift.price)",
ribbon: gift.availability != nil ?
GiftItemComponent.Ribbon(
text: "Limited",
text: environment.strings.Gift_Options_Gift_Limited,
color: .blue
)
: nil
@ -627,7 +627,7 @@ final class GiftOptionsScreenComponent: Component {
let premiumTitleSize = self.premiumTitle.update(
transition: transition,
component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "Gift Premium", font: Font.bold(28.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: strings.Gift_Options_Premium_Title, font: Font.bold(28.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center
)),
environment: {},
@ -648,7 +648,7 @@ final class GiftOptionsScreenComponent: Component {
})
let peerName = state.peer?.compactDisplayTitle ?? ""
let premiumDescriptionString = parseMarkdownIntoAttributedString("Give **\(peerName)** access to exclusive features with Telegram Premium. [See Features >]()", attributes: markdownAttributes).mutableCopy() as! NSMutableAttributedString
let premiumDescriptionString = parseMarkdownIntoAttributedString(strings.Gift_Options_Premium_Text(peerName).string, attributes: markdownAttributes).mutableCopy() as! NSMutableAttributedString
if let range = premiumDescriptionString.string.range(of: ">"), let chevronImage = self.chevronImage?.0 {
premiumDescriptionString.addAttribute(.attachment, value: chevronImage, range: NSRange(range, in: premiumDescriptionString.string))
}
@ -725,11 +725,11 @@ final class GiftOptionsScreenComponent: Component {
let title: String
switch product.months {
case 6:
title = "6 months"
title = strings.Gift_Options_Premium_Months(6)
case 12:
title = "1 year"
title = strings.Gift_Options_Premium_Years(1)
default:
title = "3 months"
title = strings.Gift_Options_Premium_Months(3)
}
let _ = visibleItem.update(
@ -743,7 +743,7 @@ final class GiftOptionsScreenComponent: Component {
peer: nil,
subject: .premium(product.months),
title: title,
subtitle: "Premium",
subtitle: strings.Gift_Options_Premium_Premium,
price: product.price,
ribbon: product.discount.flatMap {
GiftItemComponent.Ribbon(
@ -807,7 +807,7 @@ final class GiftOptionsScreenComponent: Component {
let starsTitleSize = self.starsTitle.update(
transition: transition,
component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "Send a Gift", font: Font.bold(28.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: strings.Gift_Options_Gift_Title, font: Font.bold(28.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center
)),
environment: {},
@ -820,7 +820,7 @@ final class GiftOptionsScreenComponent: Component {
transition.setBounds(view: starsTitleView, bounds: CGRect(origin: .zero, size: starsTitleSize))
}
let starsDescriptionString = parseMarkdownIntoAttributedString("Give **\(peerName)** gifts that can be kept on the profile or converted to Stars. [What are Stars >]()", attributes: markdownAttributes).mutableCopy() as! NSMutableAttributedString
let starsDescriptionString = parseMarkdownIntoAttributedString(strings.Gift_Options_Gift_Text(peerName).string, attributes: markdownAttributes).mutableCopy() as! NSMutableAttributedString
if let range = starsDescriptionString.string.range(of: ">"), let chevronImage = self.chevronImage?.0 {
starsDescriptionString.addAttribute(.attachment, value: chevronImage, range: NSRange(range, in: starsDescriptionString.string))
}
@ -873,7 +873,7 @@ final class GiftOptionsScreenComponent: Component {
var tabSelectorItems: [TabSelectorComponent.Item] = []
tabSelectorItems.append(TabSelectorComponent.Item(
id: AnyHashable(StarsFilter.all.rawValue),
title: "All Gifts"
title: strings.Gift_Options_Gift_Filter_AllGifts
))
var hasLimited = false
@ -890,7 +890,7 @@ final class GiftOptionsScreenComponent: Component {
if hasLimited {
tabSelectorItems.append(TabSelectorComponent.Item(
id: AnyHashable(StarsFilter.limited.rawValue),
title: "Limited"
title: strings.Gift_Options_Gift_Filter_Limited
))
}

View File

@ -428,7 +428,7 @@ final class GiftSetupScreenComponent: Component {
let navigationTitleSize = self.navigationTitle.update(
transition: transition,
component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "Send a Gift", font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: environment.strings.Gift_Send_Title, font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center
)),
environment: {},
@ -466,7 +466,7 @@ final class GiftSetupScreenComponent: Component {
resetText: self.resetText.flatMap {
return ListMultilineTextFieldItemComponent.ResetText(value: $0)
},
placeholder: "Enter Message",
placeholder: environment.strings.Gift_Send_Customize_MessagePlaceholder,
autocapitalizationType: .sentences,
autocorrectionType: .yes,
returnKeyType: .done,
@ -658,7 +658,7 @@ final class GiftSetupScreenComponent: Component {
theme: environment.theme,
header: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "CUSTOMIZE YOUR GIFT",
string: environment.strings.Gift_Send_Customize_Title,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
@ -727,7 +727,7 @@ final class GiftSetupScreenComponent: Component {
header: nil,
footer: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Hide my name and message from visitors to \(peerName)'s profile. \(peerName) will still see your name and message.",
string: environment.strings.Gift_Send_HideMyName_Info(peerName, peerName).string,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
@ -739,7 +739,7 @@ final class GiftSetupScreenComponent: Component {
title: AnyComponent(VStack([
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Hide My Name",
string: environment.strings.Gift_Send_HideMyName,
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
textColor: environment.theme.list.itemPrimaryTextColor
)),
@ -778,7 +778,7 @@ final class GiftSetupScreenComponent: Component {
self.starImage = (generateTintedImage(image: UIImage(bundleImageName: "Item List/PremiumIcon"), color: environment.theme.list.itemCheckColors.foregroundColor)!, environment.theme)
}
let amountString = presentationStringsFormattedNumber(Int32(component.gift.price), presentationData.dateTimeFormat.groupingSeparator)
let buttonAttributedString = NSMutableAttributedString(string: "Send a Gift for # \(amountString)", font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
let buttonAttributedString = NSMutableAttributedString(string: "\(environment.strings.Gift_Send_Send) # \(amountString)", font: Font.semibold(17.0), textColor: environment.theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
if let range = buttonAttributedString.string.range(of: "#"), let starImage = self.starImage?.0 {
buttonAttributedString.addAttribute(.attachment, value: starImage, range: NSRange(range, in: buttonAttributedString.string))
buttonAttributedString.addAttribute(.foregroundColor, value: environment.theme.list.itemCheckColors.foregroundColor, range: NSRange(range, in: buttonAttributedString.string))

View File

@ -208,13 +208,13 @@ private final class GiftViewSheetContent: CombinedComponent {
var descriptionText: String
if incoming {
if !converted {
descriptionText = "You can keep this gift in your Profile or convert it to \(convertStars) Stars. [More About Stars >]()"
descriptionText = strings.Gift_View_KeepOrConvertDescription(strings.Gift_View_KeepOrConvertDescription_Stars(Int32(convertStars))).string
} else {
descriptionText = "You converted this gift to \(convertStars) Stars. [More About Stars >]()"
descriptionText = strings.Gift_View_ConvertedDescription(strings.Gift_View_ConvertedDescription_Stars(Int32(convertStars))).string
}
} else if let peerId = component.subject.arguments?.peerId, let peer = state.peerMap[peerId] {
if case .message = component.subject {
descriptionText = "\(peer.compactDisplayTitle) can keep this gift in their Profile or convert it to \(convertStars) Stars. [More About Stars >]()"
descriptionText = strings.Gift_View_OtherDescription(peer.compactDisplayTitle, strings.Gift_View_OtherDescription_Stars(Int32(convertStars))).string
} else {
descriptionText = ""
}
@ -240,10 +240,11 @@ private final class GiftViewSheetContent: CombinedComponent {
let amountText = formattedAmount
let countColor = theme.list.itemDisclosureActions.constructive.fillColor
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(
string: incoming ? "Received Gift" : "Gift",
string: incoming ? strings.Gift_View_ReceivedTitle : strings.Gift_View_Title,
font: Font.bold(25.0),
textColor: theme.actionSheet.primaryTextColor,
paragraphAlignment: .center
@ -289,13 +290,14 @@ private final class GiftViewSheetContent: CombinedComponent {
if let peerId = component.subject.arguments?.fromPeerId, let peer = state.peerMap[peerId] {
tableItems.append(.init(
id: "from",
title: strings.Stars_Transaction_From,
title: strings.Gift_View_From,
component: AnyComponent(
Button(
content: AnyComponent(
PeerCellComponent(
context: component.context,
theme: theme,
strings: strings,
peer: peer
)
),
@ -313,11 +315,12 @@ private final class GiftViewSheetContent: CombinedComponent {
} else {
tableItems.append(.init(
id: "from_anon",
title: strings.Stars_Transaction_From,
title: strings.Gift_View_From,
component: AnyComponent(
PeerCellComponent(
context: component.context,
theme: theme,
strings: strings,
peer: nil
)
)
@ -326,7 +329,7 @@ private final class GiftViewSheetContent: CombinedComponent {
tableItems.append(.init(
id: "date",
title: strings.Stars_Transaction_Date,
title: strings.Gift_View_Date,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: stringForMediumDate(timestamp: Int32(Date().timeIntervalSince1970), strings: strings, dateTimeFormat: dateTimeFormat), font: tableFont, textColor: tableTextColor)))
)
@ -339,7 +342,7 @@ private final class GiftViewSheetContent: CombinedComponent {
}
tableItems.append(.init(
id: "availability",
title: "Availability",
title: strings.Gift_View_Availability,
component: AnyComponent(
MultilineTextComponent(text: .plain(NSAttributedString(string: "\(remains) of \(limitTotal)", font: tableFont, textColor: tableTextColor)))
)
@ -487,7 +490,7 @@ private final class GiftViewSheetContent: CombinedComponent {
if incoming && !converted {
let button = button.update(
component: SolidRoundedButtonComponent(
title: savedToProfile ? "Hide from My Page" : "Display on My Page",
title: savedToProfile ? strings.Gift_View_Hide : strings.Gift_View_Display,
theme: SolidRoundedButtonComponent.Theme(theme: theme),
font: .bold,
fontSize: 17.0,
@ -514,7 +517,7 @@ private final class GiftViewSheetContent: CombinedComponent {
let secondaryButton = secondaryButton.update(
component: SolidRoundedButtonComponent(
title: "Convert to \(convertStars) Stars",
title: strings.Gift_View_Convert(strings.Gift_View_Convert_Stars(Int32(convertStars))).string,
theme: SolidRoundedButtonComponent.Theme(backgroundColor: .clear, foregroundColor: linkColor),
font: .regular,
fontSize: 17.0,
@ -803,8 +806,8 @@ public class GiftViewScreen: ViewControllerComponentContainer {
self.dismissAnimated()
let title: String = added ? "Gift Saved to Profile" : "Gift Removed from Profile"
var text = added ? "The gift is now displayed in [your profile]()." : "The gift is no longer displayed in [your profile]()."
let title: String = added ? presentationData.strings.Gift_Displayed_Title : presentationData.strings.Gift_Hidden_Title
var text = added ? presentationData.strings.Gift_Displayed_Text : presentationData.strings.Gift_Hidden_Text
if let _ = updateSavedToProfile {
text = text.replacingOccurrences(of: "]()", with: "").replacingOccurrences(of: "[", with: "")
}
@ -848,13 +851,14 @@ public class GiftViewScreen: ViewControllerComponentContainer {
guard let self, let arguments = subject.arguments, let messageId = arguments.messageId, let fromPeerName = arguments.fromPeerName, let navigationController = self.navigationController as? NavigationController else {
return
}
let controller = textAlertController(
context: self.context,
title: "Convert Gift to Stars",
text: "Do you want to convert this gift from **\(fromPeerName)** to **\(arguments.convertStars) Stars**?\n\nThis action cannot be undone.",
title: presentationData.strings.Gift_Convert_Title,
text: presentationData.strings.Gift_Convert_Text(fromPeerName, presentationData.strings.Gift_Convert_Stars(Int32(arguments.convertStars))).string,
actions: [
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .defaultAction, title: "Convert", action: { [weak self, weak navigationController] in
TextAlertAction(type: .defaultAction, title: presentationData.strings.Gift_Convert_Convert, action: { [weak self, weak navigationController] in
if let convertToStars {
convertToStars()
} else {
@ -876,8 +880,8 @@ public class GiftViewScreen: ViewControllerComponentContainer {
animation: "StarsBuy",
scale: 0.066,
colors: [:],
title: "Gift Converted",
text: "You received **\(arguments.convertStars) Stars** instead.",
title: presentationData.strings.Gift_Convert_Success_Title,
text: presentationData.strings.Gift_Convert_Success_Text(presentationData.strings.Gift_Convert_Success_Text_Stars(Int32(arguments.convertStars))).string,
customUndoText: nil,
timeout: nil
),
@ -1183,11 +1187,13 @@ private final class TableComponent: CombinedComponent {
private final class PeerCellComponent: Component {
let context: AccountContext
let theme: PresentationTheme
let strings: PresentationStrings
let peer: EnginePeer?
init(context: AccountContext, theme: PresentationTheme, peer: EnginePeer?) {
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, peer: EnginePeer?) {
self.context = context
self.theme = theme
self.strings = strings
self.peer = peer
}
@ -1198,6 +1204,9 @@ private final class PeerCellComponent: Component {
if lhs.theme !== rhs.theme {
return false
}
if lhs.strings !== rhs.strings {
return false
}
if lhs.peer != rhs.peer {
return false
}
@ -1236,8 +1245,7 @@ private final class PeerCellComponent: Component {
peerName = peerValue.compactDisplayTitle
avatarOverride = nil
} else {
//TODO:localize
peerName = "Hidden Name"
peerName = component.strings.Gift_View_HiddenName
avatarOverride = .anonymousSavedMessagesIcon(isColored: true)
}

View File

@ -1152,8 +1152,7 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, ASGestureRecognizerDelegat
case .savedMessages:
title = presentationData.strings.PeerInfo_SavedMessagesTabTitle
case .gifts:
//TODO:localize
title = "Gifts"
title = presentationData.strings.PeerInfo_PaneGifts
}
return PeerInfoPaneSpecifier(key: key, title: title)
}, selectedPane: self.currentPaneKey, disableSwitching: disableTabSwitching, transitionFraction: self.transitionFraction, transition: transition)

View File

@ -999,8 +999,7 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 103, label: .text(""), additionalBadgeLabel: presentationData.strings.Settings_New, text: presentationData.strings.Settings_Business, icon: PresentationResourcesSettings.business, action: {
interaction.openSettings(.businessSetup)
}))
//TODO:localize
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 104, label: .text(""), text: "Send a Gift", icon: PresentationResourcesSettings.premiumGift, action: {
items[.payment]!.append(PeerInfoScreenDisclosureItem(id: 104, label: .text(""), text: presentationData.strings.Settings_SendGift, icon: PresentationResourcesSettings.premiumGift, action: {
interaction.openSettings(.premiumGift)
}))
}
@ -6100,8 +6099,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
if strongSelf.peerId.namespace == Namespaces.Peer.CloudUser, !user.isDeleted && user.botInfo == nil && !user.flags.contains(.isSupport) {
//TODO:localize
items.append(.action(ContextMenuActionItem(text: "Send a Gift", icon: { theme in
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Profile_SendGift, icon: { theme in
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Gift"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, f in
f(.dismissWithoutContent)

View File

@ -160,8 +160,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
if isVisible {
let ribbonText: String?
if let availability = product.gift.availability {
//TODO:localize
ribbonText = "1 of \(compactNumericCountString(Int(availability.total)))"
ribbonText = params.presentationData.strings.PeerInfo_Gifts_OneOf(compactNumericCountString(Int(availability.total))).string
} else {
ribbonText = nil
}
@ -291,8 +290,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
self.view.addSubview(unlockButton.view)
self.unlockButton = unlockButton
//TODO:localize
unlockButton.title = "Send Gifts to Friends"
unlockButton.title = params.presentationData.strings.PeerInfo_Gifts_Send
unlockButton.pressed = { [weak self] in
self?.buttonPressed()
@ -327,7 +325,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
transition: .immediate,
component: AnyComponent(
BalancedTextComponent(
text: .markdown(text: "These gifts were sent to you by other users. Tap on a gift to exchange it for Stars or change its privacy settings.", attributes: markdownAttributes),
text: .markdown(text: params.presentationData.strings.PeerInfo_Gifts_Info, attributes: markdownAttributes),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.2

View File

@ -54,7 +54,7 @@ private final class ScrollContent: CombinedComponent {
let component = context.component
let theme = environment.theme
//let strings = environment.strings
let strings = environment.strings
let sideInset: CGFloat = 16.0 + environment.safeInsets.left
let textSideInset: CGFloat = 30.0 + environment.safeInsets.left
@ -93,7 +93,7 @@ private final class ScrollContent: CombinedComponent {
let title = title.update(
component: BalancedTextComponent(
text: .plain(NSAttributedString(string: "What are Stars?", font: titleFont, textColor: textColor)),
text: .plain(NSAttributedString(string: strings.Stars_Info_Title, font: titleFont, textColor: textColor)),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.1
@ -109,7 +109,7 @@ private final class ScrollContent: CombinedComponent {
let text = text.update(
component: BalancedTextComponent(
text: .plain(NSAttributedString(string: "Buy packages of Stars on Telegram that let you do following:", font: textFont, textColor: secondaryTextColor)),
text: .plain(NSAttributedString(string: strings.Stars_Info_Description, font: textFont, textColor: secondaryTextColor)),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.2
@ -128,9 +128,9 @@ private final class ScrollContent: CombinedComponent {
AnyComponentWithIdentity(
id: "gift",
component: AnyComponent(ParagraphComponent(
title: "Send Gifts to Friends",
title: strings.Stars_Info_Gift_Title,
titleColor: textColor,
text: "Give your friends gifts that can be kept on their profiles or converted to Stars.",
text: strings.Stars_Info_Gift_Text,
textColor: secondaryTextColor,
accentColor: linkColor,
iconName: "Premium/StarsPerk/Gift",
@ -142,9 +142,9 @@ private final class ScrollContent: CombinedComponent {
AnyComponentWithIdentity(
id: "miniapp",
component: AnyComponent(ParagraphComponent(
title: "Use Stars in Miniapps",
title: strings.Stars_Info_Miniapp_Title,
titleColor: textColor,
text: "Buy additional content and services in Telegram miniapps. [See Examples >]()",
text: strings.Stars_Info_Miniapp_Text,
textColor: secondaryTextColor,
accentColor: linkColor,
iconName: "Premium/StarsPerk/Miniapp",
@ -159,9 +159,9 @@ private final class ScrollContent: CombinedComponent {
AnyComponentWithIdentity(
id: "media",
component: AnyComponent(ParagraphComponent(
title: "Unlock Content in Channels",
title: strings.Stars_Info_Media_Title,
titleColor: textColor,
text: "Get access to paid content and services in Telegram channels.",
text: strings.Stars_Info_Media_Text,
textColor: secondaryTextColor,
accentColor: linkColor,
iconName: "Premium/StarsPerk/Media",
@ -173,9 +173,9 @@ private final class ScrollContent: CombinedComponent {
AnyComponentWithIdentity(
id: "reaction",
component: AnyComponent(ParagraphComponent(
title: "Send Star Reactions",
title: strings.Stars_Info_Reaction_Title,
titleColor: textColor,
text: "Support your favorite channels by sending Star reactions to their posts.",
text: strings.Stars_Info_Reaction_Text,
textColor: secondaryTextColor,
accentColor: linkColor,
iconName: "Premium/StarsPerk/Reaction",
@ -248,7 +248,7 @@ private final class ContainerComponent: CombinedComponent {
return { context in
let environment = context.environment[EnvironmentType.self]
let theme = environment.theme
//let strings = environment.strings
let strings = environment.strings
let state = context.state
let controller = environment.controller
@ -336,7 +336,7 @@ private final class ContainerComponent: CombinedComponent {
let sideInset: CGFloat = 16.0 + environment.safeInsets.left
let actionButton = actionButton.update(
component: SolidRoundedButtonComponent(
title: "Got It",
title: strings.Stars_Info_Done,
theme: SolidRoundedButtonComponent.Theme(
backgroundColor: theme.list.itemCheckColors.fillColor,
backgroundColors: [],

View File

@ -2315,14 +2315,13 @@ public final class SharedAccountContextImpl: SharedAccountContext {
var openProfileImpl: ((EnginePeer) -> Void)?
var sendMessageImpl: ((EnginePeer) -> Void)?
//TODO:localize
let options = Promise<[PremiumGiftCodeOption]>()
options.set(context.engine.payments.premiumGiftCodeOptions(peerId: nil))
let controller = context.sharedContext.makeContactSelectionController(ContactSelectionControllerParams(
context: context,
mode: mode,
autoDismiss: false,
title: { strings in return "Gift Premium or Stars" },
title: { strings in return presentationData.strings.Gift_PremiumOrStars_Title },
options: contactOptions,
openProfile: { peer in
openProfileImpl?(peer)