mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Translation fixes
This commit is contained in:
parent
bb536aec28
commit
443d0293f6
@ -8716,6 +8716,7 @@ Sorry for the inconvenience.";
|
||||
"AvatarEditor.SwitchToEmoji" = "SWITCH TO EMOJI";
|
||||
"AvatarEditor.SwitchToStickers" = "SWITCH TO STICKERS";
|
||||
"AvatarEditor.SetProfilePhoto" = "Set as Profile Photo";
|
||||
"AvatarEditor.SuggestProfilePhoto" = "Suggest as Profile Photo";
|
||||
"AvatarEditor.SetGroupPhoto" = "Set as Group Photo";
|
||||
"AvatarEditor.SetChannelPhoto" = "Set as Group Photo";
|
||||
"AvatarEditor.Set" = "Set";
|
||||
|
@ -425,7 +425,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
|
||||
|
||||
if messageTextUrl != rawUrlString, !item.isGlobalSearchResult {
|
||||
var messageText = message.text
|
||||
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, !translation.text.isEmpty, item.translateToLanguage == translation.toLang {
|
||||
if !messageText.isEmpty, let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, !translation.text.isEmpty, item.translateToLanguage == translation.toLang {
|
||||
messageText = translation.text
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public func fetchMediaData(context: AccountContext, postbox: Postbox, userLocati
|
||||
var userContentType: MediaResourceUserContentType = .other
|
||||
if let image = mediaReference.media as? TelegramMediaImage {
|
||||
userContentType = .image
|
||||
if let video = image.videoRepresentations.first, forceVideo {
|
||||
if let video = image.videoRepresentations.last, forceVideo {
|
||||
resource = video.resource
|
||||
isImage = false
|
||||
} else if let representation = largestImageRepresentation(image.representations) {
|
||||
|
@ -749,6 +749,13 @@ final class AvatarEditorScreenComponent: Component {
|
||||
})
|
||||
self.addSubview(snapshotView)
|
||||
}
|
||||
|
||||
if let navigationDoneButton = self.navigationDoneButton.view, !navigationDoneButton.alpha.isZero, let snapshotView = self.navigationDoneButton.view?.snapshotContentTree() {
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||
snapshotView?.removeFromSuperview()
|
||||
})
|
||||
self.addSubview(snapshotView)
|
||||
}
|
||||
}
|
||||
|
||||
let backgroundIsBright = UIColor(rgb: state.selectedBackground.colors.first ?? 0).lightness > 0.8
|
||||
@ -1184,6 +1191,8 @@ final class AvatarEditorScreenComponent: Component {
|
||||
|
||||
let buttonText: String
|
||||
switch component.peerType {
|
||||
case .suggest:
|
||||
buttonText = strings.AvatarEditor_SuggestProfilePhoto
|
||||
case .user:
|
||||
buttonText = strings.AvatarEditor_SetProfilePhoto
|
||||
case .group, .forum:
|
||||
@ -1335,6 +1344,7 @@ final class AvatarEditorScreenComponent: Component {
|
||||
|
||||
public final class AvatarEditorScreen: ViewControllerComponentContainer {
|
||||
public enum PeerType {
|
||||
case suggest
|
||||
case user
|
||||
case group
|
||||
case channel
|
||||
|
@ -2006,6 +2006,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
var isTopReplyThreadMessageShownValue = false
|
||||
var topVisibleMessageRange: ChatTopVisibleMessageRange?
|
||||
let isLoading = historyView.originalView.isLoading
|
||||
let translateToLanguage = transactionState.historyView.associatedData.translateToLanguage
|
||||
|
||||
if let visible = displayedRange.visibleRange {
|
||||
let indexRange = (historyView.filteredEntries.count - 1 - visible.lastIndex, historyView.filteredEntries.count - 1 - visible.firstIndex)
|
||||
@ -2070,6 +2071,14 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let translateToLanguage {
|
||||
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
|
||||
} else if !message.text.isEmpty {
|
||||
messageIdsToTranslate.append(message.id)
|
||||
}
|
||||
}
|
||||
|
||||
for media in message.media {
|
||||
if let _ = media as? TelegramMediaUnsupported {
|
||||
contentRequiredValidation = true
|
||||
@ -2144,6 +2153,12 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
if let translateToLanguage {
|
||||
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
|
||||
} else if !message.text.isEmpty {
|
||||
messageIdsToTranslate.append(message.id)
|
||||
}
|
||||
}
|
||||
for media in message.media {
|
||||
if let telegramFile = media as? TelegramMediaFile {
|
||||
downloadableResourceIds.append((message.id, telegramFile.resource.id.stringRepresentation))
|
||||
@ -2194,7 +2209,6 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
}
|
||||
|
||||
let translateToLanguage = transactionState.historyView.associatedData.translateToLanguage
|
||||
var messageIdsWithPossibleReactions: [MessageId] = []
|
||||
for entry in historyView.filteredEntries {
|
||||
switch entry {
|
||||
@ -2212,13 +2226,6 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
if let translateToLanguage {
|
||||
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
|
||||
} else {
|
||||
messageIdsToTranslate.append(message.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .MessageGroupEntry(_, messages, _):
|
||||
for (message, _, _, _, _) in messages {
|
||||
|
@ -261,7 +261,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
messageEntities = updatingMedia.entities?.entities ?? []
|
||||
}
|
||||
|
||||
if let translateToLanguage = item.associatedData.translateToLanguage {
|
||||
if let translateToLanguage = item.associatedData.translateToLanguage, !item.message.text.isEmpty {
|
||||
isTranslating = true
|
||||
for attribute in item.message.attributes {
|
||||
if let attribute = attribute as? TranslationMessageAttribute, !attribute.text.isEmpty, attribute.toLang == translateToLanguage {
|
||||
|
@ -7273,7 +7273,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
return
|
||||
}
|
||||
let peerType: AvatarEditorScreen.PeerType
|
||||
if case .legacyGroup = peer {
|
||||
if mode == .suggest {
|
||||
peerType = .suggest
|
||||
} else if case .legacyGroup = peer {
|
||||
peerType = .group
|
||||
} else if case let .channel(channel) = peer {
|
||||
if case .group = channel.info {
|
||||
|
@ -114,7 +114,7 @@ public func translateMessageIds(context: AccountContext, messageIds: [EngineMess
|
||||
return context.account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
var messageIdsToTranslate: [EngineMessage.Id] = []
|
||||
for messageId in messageIds {
|
||||
if let message = transaction.getMessage(messageId), let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == toLang {
|
||||
if let message = transaction.getMessage(messageId), !message.text.isEmpty, let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == toLang {
|
||||
} else {
|
||||
messageIdsToTranslate.append(messageId)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user