WIP: add new strings

pull/1023/head
Ryan ZHAO 1 year ago
parent 71e3925820
commit 1904a795b8

@ -900,34 +900,22 @@ extension ConversationVC:
let messageDisappearingConfig = cellViewModel.messageDisappearingConfiguration()
let expirationTimerString: String = floor(messageDisappearingConfig.durationSeconds).formatted(format: .long)
let expirationTypeString: String = (messageDisappearingConfig.type?.localizedName ?? "")
let modalBodyString: String = (
messageDisappearingConfig.isEnabled ?
String(
format: "FOLLOW_SETTING_EXPLAINATION_TURNING_ON".localized(),
expirationTimerString,
expirationTypeString
) :
"FOLLOW_SETTING_EXPLAINATION_TURNING_OFF".localized()
)
let modalBodyString: String = {
if messageDisappearingConfig.isEnabled {
return "disappearingMessagesFollowSettingOn"
.put(key: "time", value: expirationTimerString)
.put(key: "disappearing messages type", value: expirationTypeString)
.localized()
} else {
return "disappearingMessagesFollowSettingOff"
.localized()
}
}()
let modalConfirmTitle: String = messageDisappearingConfig.isEnabled ? "set".localized() : "CONFIRM_BUTTON_TITLE".localized()
let confirmationModal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info(
title: "FOLLOW_SETTING_TITLE".localized(),
body: .attributedText(
NSAttributedString(string: modalBodyString)
.adding(
attributes: [ .font: UIFont.boldSystemFont(ofSize: Values.smallFontSize) ],
range: (modalBodyString as NSString).range(of: expirationTypeString)
)
.adding(
attributes: [ .font: UIFont.boldSystemFont(ofSize: Values.smallFontSize) ],
range: (modalBodyString as NSString).range(of: expirationTimerString)
)
.adding(
attributes: [ .font: UIFont.boldSystemFont(ofSize: Values.smallFontSize) ],
range: (modalBodyString as NSString).range(of: "off".localized().lowercased())
)
),
title: "disappearingMessagesFollowSetting".localized(),
body: .attributedText(modalBodyString.formatted(baseFont: .systemFont(ofSize: Values.smallFontSize))),
accessibility: Accessibility(identifier: "Follow setting dialog"),
confirmTitle: modalConfirmTitle,
confirmAccessibility: Accessibility(identifier: "Set button"),
@ -1429,7 +1417,7 @@ extension ConversationVC:
(sentTimestamp - (recentReactionTimestamps.first ?? sentTimestamp)) > (60 * 1000)
else {
let toastController: ToastController = ToastController(
text: "EMOJI_REACTS_RATE_LIMIT_TOAST".localized(),
text: "emojiReactsCoolDown".localized(),
background: .backgroundSecondary
)
toastController.presentToastView(

@ -744,15 +744,15 @@ final class ConversationVC: BaseVC, SessionUtilRespondingViewController, Convers
case (true, _):
return "noteToSelfEmpty".localized()
case (_, false):
return (threadData.profile?.blocksCommunityMessageRequests == true ?
String(
format: "COMMUNITY_MESSAGE_REQUEST_DISABLED_EMPTY_STATE".localized(),
threadData.displayName
) :
"conversationsEmpty"
.put(key: "conversationname", value: threadData.displayName)
.localized()
)
if threadData.profile?.blocksCommunityMessageRequests == true {
return "messageRequestsTurnedOff"
.put(key: "name", value: threadData.displayName)
.localized()
} else {
return "conversationsEmpty"
.put(key: "conversationname", value: threadData.displayName)
.localized()
}
default:
return "groupNoMessages"
.put(key: "groupname", value: threadData.displayName)
@ -803,13 +803,7 @@ final class ConversationVC: BaseVC, SessionUtilRespondingViewController, Convers
// Update the empty state
let text: String = emptyStateText(for: updatedThreadData)
emptyStateLabel.attributedText = NSAttributedString(string: text)
.adding(
attributes: [.font: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize)],
range: text.range(of: updatedThreadData.displayName)
.map { NSRange($0, in: text) }
.defaulting(to: NSRange(location: 0, length: 0))
)
emptyStateLabel.attributedText = text.formatted(in: emptyStateLabel)
}
if

@ -124,7 +124,7 @@ final class InfoMessageCell: MessageCell {
if cellViewModel.canDoFollowingSetting() {
self.actionLabel.isHidden = false
self.actionLabel.text = "FOLLOW_SETTING_TITLE".localized()
self.actionLabel.text = "disappearingMessagesFollowSetting".localized()
}
self.label.themeTextColor = (cellViewModel.variant == .infoClosedGroupCurrentUserErrorLeaving) ? .danger : .textSecondary

@ -92,7 +92,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
}
if threadVariant == .contact && !isNoteToSelf {
return "DISAPPERING_MESSAGES_SUBTITLE_CONTACTS".localized()
return "disappearingMessagesDescription1".localized()
}
return "disappearingMessagesDisappearAfterSendDescription".localized()

@ -208,9 +208,9 @@ final class ConversationTitleView: UIView {
case .community:
labelInfos.append(
SessionLabelCarouselView.LabelInfo(
attributedText: NSAttributedString(
string: "\(userCount) active member\(userCount == 1 ? "" : "s")"
),
attributedText: "membersActive"
.put(key: "count", value: userCount)
.localizedFormatted(baseFont: .systemFont(ofSize: Values.miniFontSize)),
accessibility: nil, // TODO: Add accessibility
type: .userCount
)

@ -615,6 +615,20 @@
"resolving" = "Resolving...";
"disappearingMessagesLegacy" = "{name} is using an outdated client. Disappearing messages may not work as expected.";
"showLess" = "Show Less";
"membersActive" = "{count} active members";
"disappearingMessagesTypeSent" = "sent";
"disappearingMessagesTypeRead" = "read";
"messageRequestsTurnedOff" = "<b>{name}</b> has message requests from Community conversations turned off, so you cannot send them a message.";
"messageRequestsCommunities" = "Community Message Requests";
"messageReqeuestsCommunitiesDescription" = "Allow message requests from Community conversations.";
"emojiReactsCoolDown" = "Slow down! You've sent too many emoji reacts. Try again soon.";
"disappearingMessagesDescription1" = "This setting applies to messages you send in this conversation.";
"disappearingMessagesFollowSetting" = "Follow Setting";
"disappearingMessagesFollowSettingOn" = "Set your messages to disappear <b>{time}</b> after they have been <b>{disappearing messages type}</b>?";
"disappearingMessagesFollowSettingOff" = "Messages you send will no longer disappear. Are you sure you want to turn <b>off</b> disappearing messages?";
"groupInviteVersion" = "Users must have version {version} or higher to receive invitations";
"blockBlockedUser" = "Blocked {name}";
"blockUnblockedUser" = "Unblocked {name}";
// NOT IN THE LIST YET
"APP_STARTUP_EXIT" = "Exit";
@ -633,7 +647,6 @@
"GROUP_UPDATE_ERROR_TITLE" = "Couldn't Update Group";
"vc_conversation_voice_message_cancel_message" = "Slide to Cancel";
"MEDIA_GALLERY_MORE_ITEMS_FORMAT" = "+%@";
"FOLLOW_SETTING_TITLE" = "Follow Setting";
"context_menu_resync" = "Resync";
"context_menu_ban_and_delete_all" = "Ban and Delete All";
"DISAPPEARING_MESSAGES_AUTO_DELETES_COUNT_DOWN" = "Auto-deletes in %@";
@ -647,12 +660,10 @@
"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only";
"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you.";
"CONVERSATION_SETTINGS_BLOCK_THIS_USER" = "Block This User";
"DISAPPERING_MESSAGES_SUBTITLE_CONTACTS" = "This setting applies to messages you send in this conversation.";
"DISAPPEARING_MESSAGES_TYPE_LEGACY_TITLE" = "Legacy"; // TODO: Delete
"DISAPPEARING_MESSAGES_TYPE_LEGACY_DESCRIPTION" = "Original version of disappearing messages."; // TODO: Delete
"FAILED_TO_STORE_OUTGOING_MESSAGE" = "An error occurred when trying to store the outgoing message for sending, you may need to restart the app before you can send messages.";
"TXT_BLOCK_USER_TITLE" = "Block User";
"COMMUNITY_MESSAGE_REQUEST_DISABLED_EMPTY_STATE" = "%@ has message requests from Community conversations turned off, so you cannot send them a message.";
"CONVERSATION_SEARCH_ONE_RESULT" = "1 match";
"DM_ERROR_DIRECT_BLINDED_ID" = "You can only send messages to Blinded IDs from within a Community";
"DM_ERROR_INVALID" = "Please check the Session ID or ONS name and try again";
@ -708,8 +719,6 @@
"CONVERSATION_SETTINGS_AUDIO_MESSAGES_AUTOPLAY_TITLE" = "Autoplay Audio Messages";
"CONVERSATION_SETTINGS_AUDIO_MESSAGES_AUTOPLAY_DESCRIPTION" = "Autoplay consecutive audio messages.";
"SETTINGS_AUDIO_DEFAULT_TONE_LABEL_FORMAT" = "%@ (default)";
"PRIVACY_SCREEN_MESSAGE_REQUESTS_COMMUNITY_TITLE" = "Community Message Requests";
"PRIVACY_SCREEN_MESSAGE_REQUESTS_COMMUNITY_DESCRIPTION" = "Allow message requests from Community conversations.";
"qrCode" = "QR Code";
"vc_qr_code_view_scan_qr_code_explanation" = "Scan someone's QR code to start a conversation with them"; // TODO: Delete
"invalid_session_id" = "Invalid Session ID"; // TODO: Delete
@ -738,10 +747,7 @@
"GIPHY_PERMISSION_TITLE" = "Search GIFs?";
"GIPHY_PERMISSION_MESSAGE" = "Session will connect to Giphy to provide search results. You will not have full metadata protection when sending GIFs.";
"ATTACHMENT_PICKER_DOCUMENTS_FAILED_ALERT_TITLE" = "Failed to choose document.";
"FOLLOW_SETTING_EXPLAINATION_TURNING_ON" = "Set your messages to disappear %@ after they have been %@?";
"FOLLOW_SETTING_EXPLAINATION_TURNING_OFF" = "Messages you send will no longer disappear. Are you sure you want to turn off disappearing messages?";
"CONFIRM_BUTTON_TITLE" = "Confirm";
"EMOJI_REACTS_RATE_LIMIT_TOAST" = "Slow down! You've sent too many emoji reacts. Try again soon.";
"MESSAGE_DELIVERY_FAILED_SYNC_TITLE" = "Failed to sync message to your other devices";
"MESSAGE_DELIVERY_FAILED_TITLE" = "Failed to send message";
"delete_message_for_me_and_my_devices" = "Delete from all of my devices";

@ -145,8 +145,8 @@ class PrivacySettingsViewModel: SessionTableViewModel, NavigationItemSource, Nav
elements: [
SessionCell.Info(
id: .communityMessageRequests,
title: "PRIVACY_SCREEN_MESSAGE_REQUESTS_COMMUNITY_TITLE".localized(),
subtitle: "PRIVACY_SCREEN_MESSAGE_REQUESTS_COMMUNITY_DESCRIPTION".localized(),
title: "messageRequestsCommunities".localized(),
subtitle: "messageReqeuestsCommunitiesDescription".localized(),
rightAccessory: .toggle(
.boolValue(
key: .checkForCommunityMessageRequests,

@ -46,9 +46,9 @@ public struct DisappearingMessagesConfiguration: Codable, Identifiable, Equatabl
case .unknown:
return ""
case .disappearAfterRead:
return "read".localized().lowercased()
return "disappearingMessagesTypeRead".localized()
case .disappearAfterSend:
return "disappearingMessagesSent".localized().lowercased()
return "disappearingMessagesTypeSent".localized()
}
}

@ -269,4 +269,8 @@ public extension String {
func formatted(in view: FontAccessible) -> NSAttributedString {
return NSAttributedString(stringWithHTMLTags: self, font: (view.fontValue ?? .systemFont(ofSize: 14)))
}
func formatted(baseFont: UIFont) -> NSAttributedString {
return NSAttributedString(stringWithHTMLTags: self, font: baseFont)
}
}

Loading…
Cancel
Save