-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocalizationHelpers.swift
More file actions
163 lines (145 loc) · 8.97 KB
/
LocalizationHelpers.swift
File metadata and controls
163 lines (145 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import SwiftUI
// MARK: - String Extension for Localization
extension String {
/// Localizes the string using the main bundle's localization resources
var localized: String {
NSLocalizedString(self, comment: "")
}
/// Localizes the string with format arguments
func localized(_ arguments: CVarArg...) -> String {
String(format: NSLocalizedString(self, comment: ""), arguments: arguments)
}
}
// MARK: - Common Localized Strings
/// Centralized location for commonly used localized strings
enum LocalizedStrings {
// MARK: - App
static let appName = NSLocalizedString("Sheaf", comment: "App name")
// MARK: - Authentication
static let signIn = NSLocalizedString("Sign In", comment: "")
static let register = NSLocalizedString("Register", comment: "")
static let email = NSLocalizedString("Email", comment: "")
static let password = NSLocalizedString("Password", comment: "")
static let confirmPassword = NSLocalizedString("Confirm Password", comment: "")
static let apiBaseURL = NSLocalizedString("API Base URL", comment: "")
static let signInToYourSystem = NSLocalizedString("Sign in to your system", comment: "")
static let createYourAccount = NSLocalizedString("Create your account", comment: "")
static let dontHaveAccount = NSLocalizedString("Don't have an account?", comment: "")
static let alreadyHaveAccount = NSLocalizedString("Already have an account?", comment: "")
static let createAccount = NSLocalizedString("Create Account", comment: "")
static let backToLogin = NSLocalizedString("Back to login", comment: "")
// MARK: - Two-Factor Auth
static let twoFactorAuth = NSLocalizedString("Two-Factor Auth", comment: "")
static let twoFactorAuthPrompt = NSLocalizedString("Enter the 6-digit code from your authenticator app", comment: "")
static let verify = NSLocalizedString("Verify", comment: "")
static let incorrectCode = NSLocalizedString("Incorrect code — please try again", comment: "")
static let twoFactorEnabled = NSLocalizedString("Enabled", comment: "")
static let twoFactorDisabled = NSLocalizedString("Disabled", comment: "")
static let setUpTwoFactorAuth = NSLocalizedString("Set Up Two-Factor Auth", comment: "")
static let manageTwoFactorAuth = NSLocalizedString("Manage Two-Factor Auth", comment: "")
// MARK: - Tabs
static let home = NSLocalizedString("Home", comment: "Tab label")
static let members = NSLocalizedString("Members", comment: "Tab label")
static let groups = NSLocalizedString("Groups", comment: "Tab label")
static let history = NSLocalizedString("History", comment: "Tab label")
static let settings = NSLocalizedString("Settings", comment: "Tab label")
// MARK: - Home
static func welcomeName(_ name: String) -> String {
String(format: NSLocalizedString("Welcome, %@!", comment: "Welcome message with name"), name)
}
static func since(_ time: String) -> String {
String(format: NSLocalizedString("Since %@", comment: "Time indicator"), time)
}
static let quickSwitch = NSLocalizedString("Quick Switch", comment: "")
static let more = NSLocalizedString("More", comment: "")
static let remove = NSLocalizedString("Remove", comment: "")
static let noOneFronting = NSLocalizedString("No one fronting", comment: "")
// MARK: - Settings
static let connection = NSLocalizedString("Connection", comment: "")
static let appearance = NSLocalizedString("Appearance", comment: "")
static let security = NSLocalizedString("Security", comment: "")
static let importData = NSLocalizedString("Import", comment: "")
static let apiURL = NSLocalizedString("API URL", comment: "")
static let token = NSLocalizedString("Token", comment: "")
static let editConnection = NSLocalizedString("Edit Connection", comment: "")
static let importFromSimplyPlural = NSLocalizedString("Import from Simply Plural", comment: "")
static let logout = NSLocalizedString("Log Out", comment: "")
static let logoutConfirmation = NSLocalizedString("Are you sure you want to log out?", comment: "")
// MARK: - Theme
static let systemTheme = NSLocalizedString("System", comment: "Theme option")
static let darkTheme = NSLocalizedString("Dark", comment: "Theme option")
static let lightTheme = NSLocalizedString("Light", comment: "Theme option")
// MARK: - Password Strength
static let passwordWeak = NSLocalizedString("Weak", comment: "Password strength")
static let passwordFair = NSLocalizedString("Fair", comment: "Password strength")
static let passwordGood = NSLocalizedString("Good", comment: "Password strength")
static let passwordStrong = NSLocalizedString("Strong", comment: "Password strength")
// MARK: - Form Labels
static let atLeast8Characters = NSLocalizedString("At least 8 characters", comment: "")
// MARK: - Quick Actions
static let addToFront = NSLocalizedString("Add to Front", comment: "")
static let addMember = NSLocalizedString("Add Member", comment: "")
// MARK: - Placeholders
static let passwordPlaceholder = NSLocalizedString("••••••••", comment: "Password placeholder")
static let apiURLPlaceholder = NSLocalizedString("https://your-api.example.com", comment: "API URL placeholder")
// MARK: - Watch
static let fronting = NSLocalizedString("Fronting", comment: "")
static let removeFromFront = NSLocalizedString("Remove from Front", comment: "")
static func switchToOnly(_ name: String) -> String {
String(format: NSLocalizedString("Switch to only %@", comment: "Switch to single fronter"), name)
}
static let noMembers = NSLocalizedString("No members", comment: "")
static let addToFrontLabel = NSLocalizedString("Add to Front", comment: "")
static func switchToOnlyFronter(_ name: String) -> String {
String(format: NSLocalizedString("Switch to %@ as the only fronter", comment: "Context menu switch"), name)
}
static let switchToOnlyFronterButton = NSLocalizedString("Switch to Only Fronter", comment: "")
static let switchFront = NSLocalizedString("Switch Front", comment: "")
static let switchTitle = NSLocalizedString("Switch", comment: "")
static let selectWhoIsFronting = NSLocalizedString("Select who is fronting", comment: "")
static let switched = NSLocalizedString("Switched!", comment: "")
static let clearFront = NSLocalizedString("Clear Front", comment: "")
static func switchCount(_ count: Int) -> String {
String(format: NSLocalizedString("Switch (%d)", comment: "Switch button with count"), count)
}
static let signOut = NSLocalizedString("Sign Out", comment: "")
static let signOutConfirmation = NSLocalizedString("Sign out?", comment: "")
static let refresh = NSLocalizedString("Refresh", comment: "")
static let url = NSLocalizedString("URL", comment: "")
// MARK: - Complications
static func countFronting(_ count: Int) -> String {
String(format: NSLocalizedString("%d fronting", comment: "Complication fronting count"), count)
}
static let noFront = NSLocalizedString("No front", comment: "Complication no fronters")
static let coFronting = NSLocalizedString("Co-fronting", comment: "")
static func plusMore(_ count: Int) -> String {
String(format: NSLocalizedString("+%d more", comment: "Additional fronters count"), count)
}
static let noFronters = NSLocalizedString("No fronters", comment: "")
static let frontingStatus = NSLocalizedString("Fronting Status", comment: "Widget display name")
static let showsWhosFronting = NSLocalizedString("Shows who's currently fronting", comment: "Widget description")
// MARK: - Common Actions
static let cancel = NSLocalizedString("Cancel", comment: "")
static let save = NSLocalizedString("Save", comment: "")
static let delete = NSLocalizedString("Delete", comment: "")
static let edit = NSLocalizedString("Edit", comment: "")
static let done = NSLocalizedString("Done", comment: "")
static let ok = NSLocalizedString("OK", comment: "")
static let yes = NSLocalizedString("Yes", comment: "")
static let no = NSLocalizedString("No", comment: "")
// MARK: - Errors
static let errorTitle = NSLocalizedString("Error", comment: "")
static let unknownError = NSLocalizedString("An unknown error occurred", comment: "")
static let passwordsDontMatch = NSLocalizedString("Passwords don't match", comment: "")
static let passwordTooShort = NSLocalizedString("Password must be at least 8 characters", comment: "")
static let urlMustStartWithHTTP = NSLocalizedString("URL must start with http:// or https://", comment: "")
static let invalidURL = NSLocalizedString("Invalid URL", comment: "")
}
// MARK: - LocalizedStringKey Extension
extension LocalizedStringKey {
/// Creates a LocalizedStringKey from a String constant
init(_ value: String) {
self.init(stringLiteral: value)
}
}