Strings.swift (10808B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2026 Bohdan, Volodymyr Potuzhnyi 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 import Foundation 18 19 /// Localized string accessors. 20 /// All accessors resolve from the active LanguageManager bundle so that 21 /// in-app language changes apply immediately without restart. 22 enum S { 23 private static var b: Bundle { LanguageManager.shared.bundle } 24 private static var t: String { "Localizable" } 25 26 private static func s(_ key: String) -> String { 27 NSLocalizedString(key, tableName: t, bundle: b, comment: "") 28 } 29 30 private static func s(_ key: String, _ arg: CVarArg) -> String { 31 String(format: NSLocalizedString(key, tableName: t, bundle: b, comment: ""), arg) 32 } 33 34 private static func s(_ key: String, _ arg1: CVarArg, _ arg2: CVarArg) -> String { 35 String(format: NSLocalizedString(key, tableName: t, bundle: b, comment: ""), arg1, arg2) 36 } 37 38 // MARK: - Menu / Navigation 39 static var menuOrder: String { s("menu_order") } 40 static var menuAmountEntry: String { s("menu_amount_entry") } 41 static var menuHistory: String { s("menu_history") } 42 static var menuSettings: String { s("menu_settings") } 43 static var menuReload: String { s("menu_reload") } 44 45 // MARK: - Products 46 static var productCategoryAll: String { s("product_category_all_objects") } 47 static var productCategoryUncategorized: String { s("product_category_uncategorized") } 48 static var productUnavailable: String { s("product_unavailable") } 49 static var productOutOfStock: String { s("product_out_of_stock") } 50 static var productWrongCurrency: String { s("product_wrong_currency") } 51 52 // MARK: - Order 53 static func orderLabelTitle(_ id: String) -> String { s("order_label_title", id) } 54 static func orderTotal(_ amount: String) -> String { s("order_total", amount) } 55 static var orderRestart: String { s("order_restart") } 56 static var orderUndo: String { s("order_undo") } 57 static var orderPrevious: String { s("order_previous") } 58 static var orderNext: String { s("order_next") } 59 static var orderCustom: String { s("order_custom") } 60 static var orderComplete: String { s("order_complete") } 61 static func orderCompleteWithAmount(_ amount: String) -> String { s("order_complete_with_amount", amount) } 62 static var orderDelete: String { s("order_delete") } 63 static var orderCustomProduct: String { s("order_custom_product") } 64 static var orderCustomAdd: String { s("order_custom_add_button") } 65 static var orderCustomProductDefault: String { s("order_custom_product_default") } 66 67 // MARK: - Amount Entry 68 static var amountEntryLabel: String { s("amount_entry_label") } 69 static var amountEntryCreateOrder: String { s("amount_entry_create_order_charge") } 70 static var amountEntryClear: String { s("amount_entry_clear") } 71 static var amountEntryProductDescription: String { s("amount_entry_product_description") } 72 static var amountEntryErrorZero: String { s("amount_entry_error_zero") } 73 static var amountEntryBackspace: String { s("amount_entry_backspace") } 74 static var amountEntryErrorWrongCurrency: String { s("amount_entry_error_wrong_currency") } 75 76 // MARK: - Config 77 static var configLabel: String { s("config_label") } 78 static var configMerchantUrl: String { s("config_merchant_url") } 79 static var configUsername: String { s("config_username") } 80 static var configPassword: String { s("config_password") } 81 static var configOk: String { s("config_ok") } 82 static var configAuthError: String { s("config_auth_error") } 83 static var configErrorNetwork: String { s("config_error_network") } 84 static var configErrorCategory: String { s("config_error_category") } 85 static var configErrorMalformed: String { s("config_error_malformed") } 86 static var configErrorUnknown: String { s("config_error_unknown") } 87 static var configFetching: String { s("config_fetching") } 88 static var configSavePassword: String { s("config_save_password") } 89 90 // MARK: - Payment 91 static var paymentIntro: String { s("payment_intro") } 92 static var paymentClaimed: String { s("payment_claimed") } 93 static var paymentCancel: String { s("payment_cancel") } 94 static var paymentReceived: String { s("payment_received") } 95 static var paymentBackButton: String { s("payment_back_button") } 96 static func paymentOrderId(_ id: String) -> String { s("payment_order_id", id) } 97 static var paymentProcessLabel: String { s("payment_process_label") } 98 static var paymentFetchingLink: String { s("payment_fetching_link") } 99 static var paymentShareUri: String { s("payment_share_uri") } 100 static var paymentCopyUri: String { s("payment_copy_uri") } 101 static var forceDeleteTitle: String { s("force_delete_dialog_title") } 102 static var forceDeleteMessage: String { s("force_delete_dialog_message") } 103 static var forceDeleteConfirm: String { s("force_delete_dialog_confirm") } 104 105 // MARK: - History 106 static var historyLabel: String { s("history_label") } 107 static var historyRefresh: String { s("history_refresh") } 108 static func historyRefNo(_ id: String) -> String { s("history_ref_no", id) } 109 static var historyUnpaid: String { s("history_status_unpaid") } 110 static var historyPaid: String { s("history_status_paid") } 111 static var historyPaymentPending: String { s("history_status_payment_pending") } 112 static var historyPaymentClaimed: String { s("history_status_payment_claimed") } 113 static var historyRefundPending: String { s("history_status_refund_pending") } 114 static var historyRefunded: String { s("history_status_refunded") } 115 static var historyShowPayment: String { s("history_show_payment") } 116 static var historyShowRefund: String { s("history_show_refund") } 117 static var historyRefund: String { s("history_refund") } 118 119 // MARK: - Refund 120 static var refundAmount: String { s("refund_amount") } 121 static var refundReason: String { s("refund_reason") } 122 static var refundAbort: String { s("refund_abort") } 123 static var refundConfirm: String { s("refund_confirm") } 124 static var refundErrorInvalidAmount: String { s("refund_error_invalid_amount") } 125 static var refundErrorZero: String { s("refund_error_zero") } 126 static var refundErrorDeadline: String { s("refund_error_deadline") } 127 static var refundErrorAlreadyRefunded: String { s("refund_error_already_refunded") } 128 static var refundIntro: String { s("refund_intro") } 129 static var refundStateMissing: String { s("refund_state_missing") } 130 static func refundErrorMaxAmount(_ amount: String) -> String { s("refund_error_max_amount", amount) } 131 132 // MARK: - Settings 133 static var settingsAppTitle: String { s("settings_app_title") } 134 static var settingsInitialOrderLabel: String { s("settings_initial_order_label") } 135 static var settingsLanguageLabel: String { s("settings_language_label") } 136 static var settingsLanguageSystemDefault: String { s("settings_language_system_default") } 137 static var settingsInstanceTitle: String { s("settings_instance_title") } 138 static var settingsInstanceButton: String { s("settings_instance_button") } 139 static var settingsLogoutButton: String { s("settings_logout_button") } 140 static var settingsAboutTitle: String { s("settings_about_title") } 141 static var settingsInstanceDescription: String { s("settings_instance_description") } 142 143 // MARK: - Errors 144 static var errorHistory: String { s("error_history") } 145 static var errorPayment: String { s("error_payment") } 146 static var errorOrderCreation: String { s("error_order_creation") } 147 static var errorInventoryUnavailable: String { s("error_inventory_unavailable") } 148 static var errorDeleteOrder: String { s("error_delete_order") } 149 150 // MARK: - Common Dialogs 151 static var commonError: String { s("common_error") } 152 static var commonOk: String { s("common_ok") } 153 154 // MARK: - Config Validation 155 static var configErrorEmptyUrl: String { s("config_error_empty_url") } 156 static var configErrorEmptyToken: String { s("config_error_empty_token") } 157 158 // MARK: - Config Mode 159 static var configModeManual: String { s("config_mode_manual") } 160 static var configModeQr: String { s("config_mode_qr") } 161 static var configQrHint: String { s("config_qr_hint") } 162 static var configQrError: String { s("config_qr_error") } 163 static var configCameraPermission: String { s("config_camera_permission") } 164 165 // MARK: - MFA / Challenge 166 static var mfaChallengeTitle: String { s("mfa_challenge_title") } 167 static func mfaChallengeMessage(_ channel: String, _ info: String) -> String { s("mfa_challenge_message", channel, info) } 168 static var mfaChallengeCodeHint: String { s("mfa_challenge_code_hint") } 169 static func mfaChallengeCodeIncomplete(_ count: Int) -> String { s("mfa_challenge_code_incomplete", count) } 170 static var mfaChooseTitle: String { s("mfa_choose_title") } 171 static var mfaChallengeInvalid: String { s("mfa_challenge_invalid") } 172 static var mfaChallengeRetry: String { s("mfa_challenge_retry") } 173 static var mfaChallengeFailed: String { s("mfa_challenge_failed") } 174 static var mfaEnterCode: String { s("mfa_enter_code") } 175 static var mfaResendCode: String { s("mfa_resend_code") } 176 static var mfaVerify: String { s("mfa_verify") } 177 static var mfaCancel: String { s("mfa_cancel") } 178 static func mfaResendFailed(_ error: String) -> String { s("mfa_resend_failed", error) } 179 static func mfaRequestFailed(_ error: String) -> String { s("mfa_request_failed", error) } 180 181 // MARK: - Brand 182 static var appName: String { s("app_name") } 183 static var appNameShort: String { s("app_name_short") } 184 static var projectName: String { s("project_name") } 185 186 // MARK: - Toasts 187 static var sessionExpiredToast: String { s("session_expired_toast") } 188 static var toastReloading: String { s("toast_reloading") } 189 static var toastReloaded: String { s("toast_reloaded") } 190 static var toastHistoryRefreshing: String { s("toast_history_refreshing") } 191 static var toastHistoryRefreshed: String { s("toast_history_refreshed") } 192 static var toastLanguageChanged: String { s("toast_language_changed") } 193 }