Skip to content

Commit

Permalink
Update localization
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac committed Apr 23, 2024
1 parent 1f4297e commit 3b719ed
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 102 deletions.
43 changes: 43 additions & 0 deletions Telegram/Telegram-iOS/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -12139,3 +12139,46 @@ Sorry for the inconvenience.";

"Channel.AdminLog.ShowMoreMessages_1" = "Show %@ More Message";
"Channel.AdminLog.ShowMoreMessages_any" = "Show %@ More Messages";

"CreatePoll.OptionCountFooterFormat_1" = "You can add {count} more option.";
"CreatePoll.OptionCountFooterFormat_any" = "You can add {count} more options.";

"Chat.AdminActionSheet.DeleteTitle_1" = "Delete 1 Message";
"Chat.AdminActionSheet.DeleteTitle_any" = "Delete %d Messages";
"Chat.AdminActionSheet.ReportSpam" = "Report Spam";
"Chat.AdminActionSheet.DeleteAllSingle" = "Delete All from %@";
"Chat.AdminActionSheet.DeleteAllMultiple" = "Delete All from Users";
"Chat.AdminActionSheet.BanSingle" = "Ban %@";
"Chat.AdminActionSheet.BanMultiple" = "Ban Users";
"Chat.AdminActionSheet.RestrictSingle" = "Ban %@";
"Chat.AdminActionSheet.RestrictMultiple" = "Ban Users";
"Chat.AdminActionSheet.RestrictSectionHeader" = "ADDITIONAL ACTIONS";
"Chat.AdminActionSheet.BanFooterSingle" = "Fully ban this user";
"Chat.AdminActionSheet.RestrictFooterSingle" = "Partially restrict this user";
"Chat.AdminActionSheet.BanFooterMultiple" = "Fully ban users";
"Chat.AdminActionSheet.RestrictFooterMultiple" = "Partially restrict users";
"Chat.AdminActionSheet.PermissionsSectionHeader" = "WHAT CAN THIS USER DO?";
"Chat.AdminActionSheet.ActionButton" = "Proceed";

"Chat.AdminAction.ToastMessagesDeletedTitleSingle" = "Message Deleted";
"Chat.AdminAction.ToastMessagesDeletedTitleMultiple" = "Messages Deleted";
"Chat.AdminAction.ToastMessagesDeletedTextSingle" = "Message Deleted.";
"Chat.AdminAction.ToastMessagesDeletedTextMultiple" = "Messages Deleted.";
"Chat.AdminAction.ToastReportedSpamText_1" = "**1** user reported for spam.";
"Chat.AdminAction.ToastReportedSpamText_any" = "**%d** users reported for spam.";
"Chat.AdminAction.ToastBannedText_1" = "**1** user banned.";
"Chat.AdminAction.ToastBannedText_any" = "**%d** users banned.";
"Chat.AdminAction.ToastRestrictedText_1" = "**1** user restricted.";
"Chat.AdminAction.ToastRestrictedText_any" = "**%d** users restricted.";

"Chat.MessageForwardInfo.StoryHeader" = "Forwarded story from";
"Chat.MessageForwardInfo.ExpiredStoryHeader" = "Expired story from";
"Chat.MessageForwardInfo.UnavailableStoryHeader" = "Expired story from";
"Chat.MessageForwardInfo.MessageHeader" = "Forwarded from";

"Chat.NavigationNoTopics" = "You have no unread topics";

"Chat.NextSuggestedChannelSwipeProgress" = "Swipe up to go to the next channel";
"Chat.NextSuggestedChannelSwipeAction" = "Release to go to the next channel";
"Chat.NextUnreadTopicSwipeProgress" = "Swipe up to go to the next topic";
"Chat.NextUnreadTopicSwipeAction" = "Release to go to the next topic";
79 changes: 47 additions & 32 deletions submodules/ComposePollUI/Sources/ComposePollScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,13 @@ final class ComposePollScreenComponent: Component {
))))
self.resetPollText = nil

//TODO:localize
let pollTextSectionSize = self.pollTextSection.update(
transition: transition,
component: AnyComponent(ListSectionComponent(
theme: environment.theme,
header: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "QUESTION",
string: environment.strings.CreatePoll_TextHeader,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
Expand All @@ -716,7 +715,7 @@ final class ComposePollScreenComponent: Component {
transition.setFrame(view: pollTextSectionView, frame: pollTextSectionFrame)

if let itemView = pollTextSectionView.itemView(id: 0) as? ListComposePollOptionComponent.View {
itemView.updateCustomPlaceholder(value: "Ask a Question", size: itemView.bounds.size, transition: .immediate)
itemView.updateCustomPlaceholder(value: environment.strings.CreatePoll_TextPlaceholder, size: itemView.bounds.size, transition: .immediate)
}
}
contentHeight += pollTextSectionSize.height
Expand Down Expand Up @@ -858,9 +857,9 @@ final class ComposePollScreenComponent: Component {
for i in 0 ..< pollOptionsSectionReadyItems.count {
let placeholder: String
if i == pollOptionsSectionReadyItems.count - 1 {
placeholder = "Add an Option"
placeholder = environment.strings.CreatePoll_AddOption
} else {
placeholder = "Option"
placeholder = environment.strings.CreatePoll_OptionPlaceholder
}

if let itemView = pollOptionsSectionReadyItems[i].itemView.contents.view as? ListComposePollOptionComponent.View {
Expand All @@ -886,7 +885,7 @@ final class ComposePollScreenComponent: Component {
transition: .immediate,
component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "POLL OPTIONS",
string: environment.strings.CreatePoll_OptionsHeader,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
Expand Down Expand Up @@ -937,26 +936,36 @@ final class ComposePollScreenComponent: Component {
if pollOptionsLimitReached {
pollOptionsFooterTransition = pollOptionsFooterTransition.withAnimation(.none)
pollOptionsComponent = AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "You have added the maximum number of options.", font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor)),
text: .plain(NSAttributedString(string: environment.strings.CreatePoll_AllOptionsAdded, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor)),
maximumNumberOfLines: 0
))
} else {
let remainingCount = 10 - self.pollOptions.count
let rawString = environment.strings.CreatePoll_OptionCountFooterFormat(Int32(remainingCount))

var pollOptionsFooterItems: [AnimatedTextComponent.Item] = []
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 0,
isUnbreakable: true,
content: .text("You can add ")
))
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 1,
isUnbreakable: true,
content: .number(10 - self.pollOptions.count, minDigits: 1)
))
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 2,
isUnbreakable: true,
content: .text(" more options.")
))
if let range = rawString.range(of: "{count}") {
if range.lowerBound != rawString.startIndex {
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 0,
isUnbreakable: true,
content: .text(String(rawString[rawString.startIndex ..< range.lowerBound]))
))
}
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 1,
isUnbreakable: true,
content: .number(remainingCount, minDigits: 1)
))
if range.upperBound != rawString.endIndex {
pollOptionsFooterItems.append(AnimatedTextComponent.Item(
id: 2,
isUnbreakable: true,
content: .text(String(rawString[range.upperBound ..< rawString.endIndex]))
))
}
}

pollOptionsComponent = AnyComponent(AnimatedTextComponent(
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
color: environment.theme.list.freeTextColor,
Expand Down Expand Up @@ -997,7 +1006,7 @@ final class ComposePollScreenComponent: Component {
title: AnyComponent(VStack([
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Anonymous Voting",
string: environment.strings.CreatePoll_Anonymous,
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
textColor: environment.theme.list.itemPrimaryTextColor
)),
Expand All @@ -1018,7 +1027,7 @@ final class ComposePollScreenComponent: Component {
title: AnyComponent(VStack([
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Multiple Answers",
string: environment.strings.CreatePoll_MultipleChoice,
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
textColor: environment.theme.list.itemPrimaryTextColor
)),
Expand All @@ -1042,7 +1051,7 @@ final class ComposePollScreenComponent: Component {
title: AnyComponent(VStack([
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Quiz Mode",
string: environment.strings.CreatePoll_Quiz,
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
textColor: environment.theme.list.itemPrimaryTextColor
)),
Expand All @@ -1069,7 +1078,7 @@ final class ComposePollScreenComponent: Component {
header: nil,
footer: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Polls in Quiz Mode have one correct answer. Users can't revoke their answers.",
string: environment.strings.CreatePoll_QuizInfo,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
Expand Down Expand Up @@ -1098,15 +1107,15 @@ final class ComposePollScreenComponent: Component {
theme: environment.theme,
header: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "EXPLANATION",
string: environment.strings.CreatePoll_ExplanationHeader,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
maximumNumberOfLines: 0
)),
footer: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(
string: "Users will see this comment after choosing a wrong answer, good for educational purposes.",
string: environment.strings.CreatePoll_ExplanationInfo,
font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize),
textColor: environment.theme.list.freeTextColor
)),
Expand Down Expand Up @@ -1421,6 +1430,11 @@ final class ComposePollScreenComponent: Component {
if sendButtonItem.isEnabled != isValid {
sendButtonItem.isEnabled = isValid
}

let controllerTitle = self.isQuiz ? presentationData.strings.CreatePoll_QuizTitle : presentationData.strings.CreatePoll_Title
if controller.title != controllerTitle {
controller.title = controllerTitle
}
}

if let currentEditingTag = self.currentEditingTag, previousEditingTag !== currentEditingTag, self.currentInputMode != .keyboard {
Expand Down Expand Up @@ -1514,12 +1528,13 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont
completion: completion
), navigationBarAppearance: .default, theme: .default)

//TODO:localize
self.title = "New Poll"
let presentationData = context.sharedContext.currentPresentationData.with { $0 }

self.title = isQuiz == true ? presentationData.strings.CreatePoll_QuizTitle : presentationData.strings.CreatePoll_Title

self.navigationItem.setLeftBarButton(UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(self.cancelPressed)), animated: false)
self.navigationItem.setLeftBarButton(UIBarButtonItem(title: presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.cancelPressed)), animated: false)

let sendButtonItem = UIBarButtonItem(title: "Send", style: .done, target: self, action: #selector(self.sendPressed))
let sendButtonItem = UIBarButtonItem(title: presentationData.strings.CreatePoll_Create, style: .done, target: self, action: #selector(self.sendPressed))
self.sendButtonItem = sendButtonItem
self.navigationItem.setRightBarButton(sendButtonItem, animated: false)
sendButtonItem.isEnabled = false
Expand Down
Loading

0 comments on commit 3b719ed

Please sign in to comment.