Update localization

This commit is contained in:
Ali 2021-02-16 01:03:36 +04:00
parent c38f6502d4
commit bad4cc2b44
5 changed files with 4565 additions and 4484 deletions

View File

@ -6091,3 +6091,12 @@ Sorry for the inconvenience.";
"Conversation.AlsoClearCacheTitle" = "You can use \"clear cache\" to remove unnecessary media — and re-downloaded files if you need them again.";
"Conversation.DeleteAllMessagesInChat" = "Are you sure you want to delete all messages in %@?";
"Conversation.AutoremoveTimerSetUserYou" = "You set messages to automatically delete after %2$@";
"Conversation.AutoremoveTimerSetUser" = "%1$@ set messages to automatically delete after %2$@";
"Conversation.AutoremoveTimerRemovedUserYou" = "You disabled the auto-delete timer";
"Conversation.AutoremoveTimerRemovedUser" = "%1$@ disabled the auto-delete timer";
"Conversation.AutoremoveTimerSetGroup" = "A group admin set messages to automatically delete after %1$@";
"Conversation.AutoremoveTimerRemovedGroup" = "A group admin disabled the auto-delete timer";
"Conversation.AutoremoveTimerSetChannel" = "Messages in this channel will be automatically deleted after %1$@";
"Conversation.AutoremoveTimerRemovedChannel" = "Messages in this channel will no longer be automatically deleted";

View File

@ -37,19 +37,35 @@ public func presentationStringsFormattedNumber(_ count: Int32, _ groupingSeparat
}
}
public func timeIntervalString(strings: PresentationStrings, value: Int32, roundToNearest: Bool = false) -> String {
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)))
public func timeIntervalString(strings: PresentationStrings, value: Int32, preferLowerValue: Bool = false, roundToNearest: 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 {
return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30)))
}
} else {
return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30)))
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 {
return strings.MessageTimer_Months(max(1, value / (60 * 60 * 24 * 30)))
}
}
}

View File

@ -261,34 +261,72 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
case .channelMigratedFromGroup, .groupMigratedToChannel:
attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor)
case let .messageAutoremoveTimeoutUpdated(timeout):
let authorString: String
if let author = messageMainPeer(message) {
authorString = author.compactDisplayTitle
} else {
authorString = ""
}
let messagePeer = message.peers[message.id.peerId]
if timeout > 0 {
let timeValue = timeIntervalString(strings: strings, value: timeout)
let timeValue = timeIntervalString(strings: strings, value: timeout, preferLowerValue: true)
/*
"Conversation.AutoremoveTimerSetUserYou" = "You set messages to automatically delete after %2$@.";
"Conversation.AutoremoveTimerSetUser" = "%1$@ set messages to automatically delete after %2$@.";
"Conversation.AutoremoveTimerRemovedUserYou" = "You disabled the self-destruct timer";
"Conversation.AutoremoveTimerRemovedUser" = "%1$@ disabled the self-destruct timer";
"Conversation.AutoremoveTimerSetGroup" = "Messages will automatically delete after %1$@.";
"Conversation.AutoremoveTimerRemovedGroup" = "Self-destruct timer was disabled";
*/
let string: String
if message.author?.id == accountPeerId {
string = strings.Notification_MessageLifetimeChangedOutgoing(timeValue).0
} else {
let authorString: String
if let author = messageMainPeer(message) {
authorString = author.compactDisplayTitle
if let _ = messagePeer as? TelegramUser {
if message.author?.id == accountPeerId {
string = strings.Conversation_AutoremoveTimerSetUserYou(timeValue).0
} else {
authorString = ""
string = strings.Conversation_AutoremoveTimerSetUser(authorString, timeValue).0
}
} else if let _ = messagePeer as? TelegramGroup {
string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).0
} else if let channel = messagePeer as? TelegramChannel {
if case .group = channel.info {
string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).0
} else {
string = strings.Conversation_AutoremoveTimerSetChannel(timeValue).0
}
} else {
if message.author?.id == accountPeerId {
string = strings.Notification_MessageLifetimeChangedOutgoing(timeValue).0
} else {
string = strings.Notification_MessageLifetimeChanged(authorString, timeValue).0
}
string = strings.Notification_MessageLifetimeChanged(authorString, timeValue).0
}
attributedString = NSAttributedString(string: string, font: titleFont, textColor: primaryTextColor)
} else {
let string: String
if message.author?.id == accountPeerId {
string = strings.Notification_MessageLifetimeRemovedOutgoing
} else {
let authorString: String
if let author = messageMainPeer(message) {
authorString = author.compactDisplayTitle
if let _ = messagePeer as? TelegramUser {
if message.author?.id == accountPeerId {
string = strings.Conversation_AutoremoveTimerRemovedUserYou
} else {
authorString = ""
string = strings.Conversation_AutoremoveTimerRemovedUser(authorString).0
}
} else if let _ = messagePeer as? TelegramGroup {
string = strings.Conversation_AutoremoveTimerRemovedGroup
} else if let channel = messagePeer as? TelegramChannel {
if case .group = channel.info {
string = strings.Conversation_AutoremoveTimerRemovedGroup
} else {
string = strings.Conversation_AutoremoveTimerRemovedChannel
}
} else {
if message.author?.id == accountPeerId {
string = strings.Notification_MessageLifetimeRemovedOutgoing
} else {
string = strings.Notification_MessageLifetimeRemoved(authorString).0
}
string = strings.Notification_MessageLifetimeRemoved(authorString).0
}
attributedString = NSAttributedString(string: string, font: titleFont, textColor: primaryTextColor)
}