Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Text to Localized #905

Merged
merged 3 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Planetary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@
8D8A7B17231944030087895B /* CGSize+Square.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D8A7B16231944030087895B /* CGSize+Square.swift */; };
8D8A7B19231995670087895B /* PostHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D8A7B18231995670087895B /* PostHeaderView.swift */; };
8D9143F6230C5F4E0075BC8A /* Localizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EE230C5F4E0075BC8A /* Localizable.swift */; };
8D9143F7230C5F4E0075BC8A /* Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EF230C5F4E0075BC8A /* Text.swift */; };
8D9143F7230C5F4E0075BC8A /* Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EF230C5F4E0075BC8A /* Localized.swift */; };
8DA9567D230DA46C00A334EB /* UIButton+Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DA9567C230DA46C00A334EB /* UIButton+Text.swift */; };
8DB041FD234FA994006AC35B /* Identity+Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D35CEC42347E370004A4191 /* Identity+Bot.swift */; };
8DB041FE234FAA48006AC35B /* Identity+Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D35CEC42347E370004A4191 /* Identity+Bot.swift */; };
Expand Down Expand Up @@ -1025,6 +1025,8 @@
C9A1632328ADE33800ACDCC5 /* ManageAliasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A1632128ADE33800ACDCC5 /* ManageAliasView.swift */; };
C9A1632628AE88DC00ACDCC5 /* AddAliasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A1632528AE88DC00ACDCC5 /* AddAliasView.swift */; };
C9A1632728AE88DC00ACDCC5 /* AddAliasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A1632528AE88DC00ACDCC5 /* AddAliasView.swift */; };
C9A2894528F5C97200B347B7 /* SwiftUI+Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A2894428F5C97200B347B7 /* SwiftUI+Localized.swift */; };
C9A2894628F5C97200B347B7 /* SwiftUI+Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A2894428F5C97200B347B7 /* SwiftUI+Localized.swift */; };
C9A2DE2927CFCB5F00EAFA73 /* Publisher+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A2DE2827CFCB5F00EAFA73 /* Publisher+Async.swift */; };
C9A2DE2A27CFCB6000EAFA73 /* Publisher+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A2DE2827CFCB5F00EAFA73 /* Publisher+Async.swift */; };
C9A2DE2B27CFCB6000EAFA73 /* Publisher+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A2DE2827CFCB5F00EAFA73 /* Publisher+Async.swift */; };
Expand Down Expand Up @@ -1137,7 +1139,7 @@
C9F0B6C227E2728800BE2F0E /* Generated.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9F0B67427E2728700BE2F0E /* Generated.strings */; };
C9F0B6C327E2728800BE2F0E /* Generated.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9F0B67727E2728700BE2F0E /* Generated.strings */; };
C9F0B6C427E2728800BE2F0E /* Generated.strings in Resources */ = {isa = PBXBuildFile; fileRef = C9F0B67727E2728700BE2F0E /* Generated.strings */; };
C9F1C84827C9283A005A3228 /* Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EF230C5F4E0075BC8A /* Text.swift */; };
C9F1C84827C9283A005A3228 /* Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EF230C5F4E0075BC8A /* Localized.swift */; };
C9F1C84927C92842005A3228 /* Localizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D9143EE230C5F4E0075BC8A /* Localizable.swift */; };
C9F1C84B27C932A8005A3228 /* Generated.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0AC10DD9246C43DC00CCA22A /* Generated.strings */; };
C9F1C84C27C932AF005A3228 /* Generated.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0A04D8B62477220F00DD37B7 /* Generated.strings */; };
Expand Down Expand Up @@ -1643,7 +1645,7 @@
8D8A7B16231944030087895B /* CGSize+Square.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGSize+Square.swift"; sourceTree = "<group>"; };
8D8A7B18231995670087895B /* PostHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHeaderView.swift; sourceTree = "<group>"; };
8D9143EE230C5F4E0075BC8A /* Localizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localizable.swift; sourceTree = "<group>"; };
8D9143EF230C5F4E0075BC8A /* Text.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Text.swift; sourceTree = "<group>"; };
8D9143EF230C5F4E0075BC8A /* Localized.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localized.swift; sourceTree = "<group>"; };
8DA9567C230DA46C00A334EB /* UIButton+Text.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Text.swift"; sourceTree = "<group>"; };
8DB041FF235539F5006AC35B /* DirectoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectoryViewController.swift; sourceTree = "<group>"; };
8DB042012355ECC6006AC35B /* AboutTableViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTableViewDataSource.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1718,6 +1720,7 @@
C99DC1B928F5C21300880A2E /* Assets+Planetary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Assets+Planetary.swift"; sourceTree = "<group>"; };
C9A1632128ADE33800ACDCC5 /* ManageAliasView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManageAliasView.swift; sourceTree = "<group>"; };
C9A1632528AE88DC00ACDCC5 /* AddAliasView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAliasView.swift; sourceTree = "<group>"; };
C9A2894428F5C97200B347B7 /* SwiftUI+Localized.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SwiftUI+Localized.swift"; sourceTree = "<group>"; };
C9A2DE2827CFCB5F00EAFA73 /* Publisher+Async.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Async.swift"; sourceTree = "<group>"; };
C9A2DE2C27CFD61800EAFA73 /* ConnectedPeerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectedPeerCell.swift; sourceTree = "<group>"; };
C9A2DE3127CFD66000EAFA73 /* PeerConnectionInfo+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PeerConnectionInfo+Preview.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2423,6 +2426,7 @@
C9F1C85427C9875A005A3228 /* Color+Hex.swift */,
C9EADA8827D178D5002066D9 /* View+RoundedCorner.swift */,
C920A3A5289B1525009C83F3 /* Array+Chunked.swift */,
C9A2894428F5C97200B347B7 /* SwiftUI+Localized.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -2744,7 +2748,7 @@
C9F0B61127E2728500BE2F0E /* ExportStrings.sh */,
C9F0B61227E2728500BE2F0E /* ExportStrings.swift */,
8D9143EE230C5F4E0075BC8A /* Localizable.swift */,
8D9143EF230C5F4E0075BC8A /* Text.swift */,
8D9143EF230C5F4E0075BC8A /* Localized.swift */,
C9F0B61327E2728500BE2F0E /* af-ZA.lproj */,
C9F0B64C27E2728700BE2F0E /* ar-SA.lproj */,
C9F0B64F27E2728700BE2F0E /* ca-ES.lproj */,
Expand Down Expand Up @@ -4106,7 +4110,7 @@
C997F3E128B1D86D00DAC117 /* AliasCell.swift in Sources */,
8DB041FD234FA994006AC35B /* Identity+Bot.swift in Sources */,
C9724B9A2809EA8C000EBCCD /* Array+IndexPath.swift in Sources */,
C9F1C84827C9283A005A3228 /* Text.swift in Sources */,
C9F1C84827C9283A005A3228 /* Localized.swift in Sources */,
C982CBE428353E7400D8963F /* Support+GoBot.swift in Sources */,
5B2A4F9B28205C8F00A5BE48 /* PostsAlgorithm.swift in Sources */,
C9724BAE2809EBE4000EBCCD /* MarkdownStyler.swift in Sources */,
Expand Down Expand Up @@ -4269,6 +4273,7 @@
C9724BA62809EB09000EBCCD /* DebugViewController.swift in Sources */,
C9724BF12809EFBE000EBCCD /* EditValueView.swift in Sources */,
53C2B1362295ACFE0018D0A8 /* AppConfiguration+Keychain.swift in Sources */,
C9A2894628F5C97200B347B7 /* SwiftUI+Localized.swift in Sources */,
C9724B162809D2F3000EBCCD /* SettingsViewController.swift in Sources */,
C9724BF02809EF4D000EBCCD /* UIView+Superview.swift in Sources */,
531A8A4A21FA3C6400D5C8C0 /* Message.swift in Sources */,
Expand Down Expand Up @@ -4542,7 +4547,7 @@
0AAF8C4725C704B500FD8D0F /* UnfollowOperation.swift in Sources */,
0AF2DEEE247C3EE6003F457D /* Hashtag+Link.swift in Sources */,
5396A6232244356600C57A4B /* Layout+ContentView.swift in Sources */,
8D9143F7230C5F4E0075BC8A /* Text.swift in Sources */,
8D9143F7230C5F4E0075BC8A /* Localized.swift in Sources */,
53E26C4C230223F8009240B2 /* AppController+Push.swift in Sources */,
530F01B422E0D3E7007EBAE2 /* TitledToggle.swift in Sources */,
53AD3FD1226F736A005228F9 /* UIViewTapGesture.swift in Sources */,
Expand Down Expand Up @@ -4704,6 +4709,7 @@
53EAB39A239B106900DF5530 /* CachesViewController.swift in Sources */,
53B634B6221627CC00400403 /* UIView+AutoLayout.swift in Sources */,
53BD748823235A450060E47E /* Post+Blob.swift in Sources */,
C9A2894528F5C97200B347B7 /* SwiftUI+Localized.swift in Sources */,
23C7443E2200B12000FB554A /* Mention.swift in Sources */,
0AF9E0AA246B23C700910575 /* SuspendOperation.swift in Sources */,
5319F06B234EDC8000F4D3C1 /* UIView+HeaderView.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Shared/Extensions/Bool+YesOrNo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import Foundation

extension Bool {
var yesOrNo: String {
self ? Text.yes.text : Text.no.text
self ? Localized.yes.text : Localized.no.text
}
}
2 changes: 1 addition & 1 deletion Shared/Extensions/Text+Gradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import SwiftUI

extension SwiftUI.Text {
extension Text {

/// Colors the text with the given gradient
public func foregroundLinearGradient(colors: [Color], startPoint: UnitPoint, endPoint: UnitPoint) -> some View {
Expand Down
16 changes: 8 additions & 8 deletions Shared/Extensions/UIViewController+Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ protocol AlertRouter {
extension UIViewController: AlertRouter {

func alert(error: Error) {
let controller = UIAlertController(title: Text.error.text,
let controller = UIAlertController(title: Localized.error.text,
message: error.localizedDescription,
preferredStyle: .alert)
controller.view.tintColor = UIColor.tint.system

let cancelAction = UIAlertAction(title: Text.cancel.text,
let cancelAction = UIAlertAction(title: Localized.cancel.text,
style: .cancel) { _ in
controller.dismiss(animated: true)
}
Expand All @@ -48,7 +48,7 @@ extension UIViewController: AlertRouter {
func alert(from sourceView: AnyObject? = nil,
title: String? = nil,
message: String,
cancelTitle: String = Text.cancel.text,
cancelTitle: String = Localized.cancel.text,
cancelClosure: (() -> Void)? = nil) {

let cancel = UIAlertAction(title: cancelTitle, style: .cancel) { _ in
Expand All @@ -65,7 +65,7 @@ extension UIViewController: AlertRouter {
from sourceView: AnyObject? = nil,
title: String? = nil,
message: String,
cancelTitle: String = Text.cancel.text
cancelTitle: String = Localized.cancel.text
) async {

await withCheckedContinuation { continuation in
Expand All @@ -92,9 +92,9 @@ extension UIViewController: AlertRouter {
title: String? = nil,
message: String,
isDestructive: Bool = false,
cancelTitle: String = Text.cancel.text,
cancelTitle: String = Localized.cancel.text,
cancelClosure: (() -> Void)? = nil,
confirmTitle: String = Text.ok.text,
confirmTitle: String = Localized.ok.text,
confirmClosure: @escaping (() -> Void)) {

let confirm = UIAlertAction(title: confirmTitle,
Expand All @@ -116,8 +116,8 @@ extension UIViewController: AlertRouter {
title: String? = nil,
message: String,
isDestructive: Bool = false,
cancelTitle: String = Text.cancel.text,
confirmTitle: String = Text.ok.text
cancelTitle: String = Localized.cancel.text,
confirmTitle: String = Localized.ok.text
) async -> Bool {

await withCheckedContinuation { continuation in
Expand Down
2 changes: 1 addition & 1 deletion Shared/Extensions/UIViewController+NavigationItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension UIViewController {

func addDismissBarButtonItem() {
let item = UIBarButtonItem(image: UIImage.verse.dismiss, style: .plain, target: self, action: #selector(didPressDismiss))
item.accessibilityLabel = Text.done.text
item.accessibilityLabel = Localized.done.text
self.navigationItem.leftBarButtonItem = item
}

Expand Down
6 changes: 3 additions & 3 deletions Source/App/AppController+Push.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ extension AppController {
) {
let controller = viewController ?? self
controller.confirm(
title: Text.Push.title.text,
message: Text.Push.prompt.text,
title: Localized.Push.title.text,
message: Localized.Push.prompt.text,
isDestructive: false,
cancelClosure: { completion?(status) },
confirmTitle: Text.settings.text,
confirmTitle: Localized.settings.text,
confirmClosure: AppController.shared.openOSSettings
)
}
Expand Down
4 changes: 2 additions & 2 deletions Source/App/AppController+URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ extension AppController {
let controller = UIAlertController(title: "This is an invite to a Pub",
message: "Are you sure you want to redeem this invite?",
preferredStyle: .alert)
var action = UIAlertAction(title: Text.cancel.text, style: .cancel) {
var action = UIAlertAction(title: Localized.cancel.text, style: .cancel) {
_ in
controller.dismiss(animated: true, completion: nil)
}
controller.addAction(action)

action = UIAlertAction(title: Text.yes.text, style: .default) { [weak self] _ in
action = UIAlertAction(title: Localized.yes.text, style: .default) { [weak self] _ in
controller.dismiss(animated: false, completion: nil)
self?.showProgress()
let star = Star(invite: invite)
Expand Down
10 changes: 5 additions & 5 deletions Source/App/AppDelegate+Push.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,34 @@ extension AppDelegate: UNUserNotificationCenterDelegate {

let content = UNMutableNotificationContent()

let nameToShow = about?.nameOrIdentity ?? Text.Report.somebody.text
let nameToShow = about?.nameOrIdentity ?? Localized.Report.somebody.text

// swiftlint:disable legacy_objc_type
switch report.reportType {
case .feedFollowed:
content.title = NSString.localizedUserNotificationString(
forKey: Text.Report.feedFollowed.text,
forKey: Localized.Report.feedFollowed.text,
arguments: [nameToShow]
)
case .postReplied:
content.title = NSString.localizedUserNotificationString(
forKey: Text.Report.postReplied.text,
forKey: Localized.Report.postReplied.text,
arguments: [nameToShow]
)
if let what = report.message.content.post?.text {
content.body = what.withoutGallery().decodeMarkdown().string
}
case .feedMentioned:
content.title = NSString.localizedUserNotificationString(
forKey: Text.Report.feedMentioned.text,
forKey: Localized.Report.feedMentioned.text,
arguments: [nameToShow]
)
if let what = report.message.content.post?.text {
content.body = what.withoutGallery().decodeMarkdown().string
}
case .messageLiked:
content.title = NSString.localizedUserNotificationString(
forKey: Text.Report.messageLiked.text,
forKey: Localized.Report.messageLiked.text,
arguments: [nameToShow]
)
}
Expand Down
4 changes: 2 additions & 2 deletions Source/App/AppError+LocalizedError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ extension AppError: LocalizedError {
var errorDescription: String? {
switch self {
case .unexpected:
return Text.Error.unexpected.text
return Localized.Error.unexpected.text
case .invalidInvite:
return Text.Error.unexpected.text
return Localized.Error.unexpected.text
}
}
}
8 changes: 4 additions & 4 deletions Source/Bot/BotError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ enum BotError: Error, LocalizedError {
case .notLoggedIn:
return "Not logged in"
case .forkProtection:
return Text.Error.cannotPublishBecauseRestoring.text
return Localized.Error.cannotPublishBecauseRestoring.text
case .invalidAppConfiguration:
return Text.Error.invalidAppConfiguration.text
return Localized.Error.invalidAppConfiguration.text
case .restoring:
return Text.Error.restoring.text
return Localized.Error.restoring.text
case .internalError:
return Text.Error.unexpected.text
return Localized.Error.unexpected.text
}
}
}
2 changes: 1 addition & 1 deletion Source/Bot/Operations/RedeemInviteOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RedeemInviteOperation: AsynchronousOperation {
// Construct a better error message before returning
Bots.current.about(identity: self.star.feed) { about, _ in
let starName = about?.name ?? self.star.feed
let localizedMessage = Text.Error.invitationRedemptionFailed.text(["starName": starName])
let localizedMessage = Localized.Error.invitationRedemptionFailed.text(["starName": starName])
let userError = NSError(
domain: String(describing: type(of: self)),
code: 0,
Expand Down
Loading