From 0f0e91273e2c0d30888fb3280782ed99dca58c80 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Tue, 25 Jan 2022 18:28:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Localisation=20improvements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon-common/PHP/PHP Version/PhpEnv.swift | 8 +++++--- .../Integrations/Composer/ComposerJson.swift | 2 +- phpmon/Domain/SiteList/SiteListCell.swift | 8 +++----- phpmon/Localizable.strings | 15 +++++++++++++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/phpmon-common/PHP/PHP Version/PhpEnv.swift b/phpmon-common/PHP/PHP Version/PhpEnv.swift index bcac813..c42bcbd 100644 --- a/phpmon-common/PHP/PHP Version/PhpEnv.swift +++ b/phpmon-common/PHP/PHP Version/PhpEnv.swift @@ -149,8 +149,10 @@ class PhpEnv { } public func validVersions(for constraint: String) -> [PhpVersionNumber] { - return PhpVersionNumberCollection - .make(from: self.availablePhpVersions) - .matching(constraint: constraint) + constraint.split(separator: "|").flatMap { + return PhpVersionNumberCollection + .make(from: self.availablePhpVersions) + .matching(constraint: $0.trimmingCharacters(in: .whitespacesAndNewlines)) + } } } diff --git a/phpmon/Domain/Integrations/Composer/ComposerJson.swift b/phpmon/Domain/Integrations/Composer/ComposerJson.swift index 0752733..011fc78 100644 --- a/phpmon/Domain/Integrations/Composer/ComposerJson.swift +++ b/phpmon/Domain/Integrations/Composer/ComposerJson.swift @@ -21,7 +21,7 @@ struct ComposerJson: Decodable { // Check if in dependencies if dependencies?["php"] != nil { - return (dependencies!["php"]!, "dependency list") + return (dependencies!["php"]!, "require") } // Unknown! diff --git a/phpmon/Domain/SiteList/SiteListCell.swift b/phpmon/Domain/SiteList/SiteListCell.swift index d525c8a..4d976ec 100644 --- a/phpmon/Domain/SiteList/SiteListCell.swift +++ b/phpmon/Domain/SiteList/SiteListCell.swift @@ -87,19 +87,17 @@ class SiteListCell: NSTableCellView alert.informativeText = "alert.composer_php_requirement.info" .localized(site.composerPhpSource) - alert.addButton(withTitle: "Close") + alert.addButton(withTitle: "site_link.close".localized) var mapIndex: Int = NSApplication.ModalResponse.alertSecondButtonReturn.rawValue var map: [Int: String] = [:] // Determine which installed versions would be ideal to switch to, // but make sure to exclude the currently linked version - site.composerPhp.split(separator: "|").flatMap { string in - return PhpEnv.shared.validVersions(for: string.trimmingCharacters(in: .whitespacesAndNewlines)) - }.filter({ version in + PhpEnv.shared.validVersions(for: site.composerPhp).filter({ version in version.homebrewVersion != PhpEnv.phpInstall.version.short }).forEach { version in - alert.addButton(withTitle: "Switch to PHP \(version.homebrewVersion)") + alert.addButton(withTitle: "site_link.switch_to_php".localized(version.homebrewVersion)) map[mapIndex] = version.homebrewVersion mapIndex += 1 } diff --git a/phpmon/Localizable.strings b/phpmon/Localizable.strings index 893a286..a637e66 100644 --- a/phpmon/Localizable.strings +++ b/phpmon/Localizable.strings @@ -69,6 +69,17 @@ "site_list.confirm_unlink" = "Are you sure you want to unlink '%@'?"; "site_link.confirm_link" = "No files will be removed. If needed, the site will need to be relinked via the command line."; +"site_link.close" = "Close"; +"site_link.switch_to_php" = "Switch to PHP %@"; + +// ADD SITE TO SITE LIST + +"site_list.add.link_folder" = "Link a Folder"; +"site_list.add.domain_name_placeholder" = "Enter a domain name here"; +"site_list.add.secure_after_creation" = "Secure %@.%@ after creation"; +"site_list.add.secure_description" = "Securing a site requires administrative privileges.\nYou will be prompted for your password or Touch ID."; +"site_list.add.create_link" = "Create Link"; +"site_list.add.cancel" = "Cancel"; "site_list.add.folder_available" = "This site will be available via the following URL: %@://%@.%@"; // SITE LIST ACTIONS @@ -153,8 +164,8 @@ problem manually, using your own Terminal app (this just shows you the output)." "alert.composer_success.info" = "Your global Composer dependencies have been successfully updated."; // Composer Version -"alert.composer_php_requirement.title" = "`%@` has the following PHP requirement: \"php\": \"%@\"."; -"alert.composer_php_requirement.info" = "This required PHP version was determined by checking the %@ in `composer.json` when the list was last refreshed."; +"alert.composer_php_requirement.title" = "`%@` has the following PHP requirement: \"php\":\n\"%@\"."; +"alert.composer_php_requirement.info" = "This required PHP version was determined by checking the `%@` field in the `composer.json` file when the site list was last refreshed."; // Force Reload Started "alert.force_reload.title" = "PHP Monitor will force reload the latest version of PHP";