Localization support for Plugin Categories #207

This commit is contained in:
Alexander Mazanov 2021-07-05 10:32:27 -04:00
parent 905a8ecf75
commit 32a8a8db2c
7 changed files with 126 additions and 1 deletions

View File

@ -151,6 +151,7 @@
39224E3225F4351300BABF21 /* SwiftBarMAS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SwiftBarMAS.xcconfig; sourceTree = "<group>"; };
39224E5625F52F7400BABF21 /* SwiftBar MAS.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "SwiftBar MAS.entitlements"; sourceTree = "<group>"; };
39224E5B25F530AF00BABF21 /* EnvConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvConfig.swift; sourceTree = "<group>"; };
39294CD526934EDD00C6BB29 /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Localizable.strings; sourceTree = "<group>"; };
393375E625507ADE0050AC28 /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
393375EB25508B320050AC28 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
395ADA652592359E003EFA25 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -498,6 +499,7 @@
Base,
de,
nl,
hr,
);
mainGroup = 3920747125460FD000213DBE;
packageReferences = (
@ -785,6 +787,7 @@
396E6CAA258E8C5C002C735D /* en */,
396E6CAD258E8CA8002C735D /* de */,
395ADA652592359E003EFA25 /* nl */,
39294CD526934EDD00C6BB29 /* hr */,
);
name = Localizable.strings;
sourceTree = "<group>";

View File

@ -64,6 +64,31 @@ enum Localizable {
case InstallStatusFailed = "PR_INSTALL_STATUS_FAILED"
case InstallStatusDownloading = "PR_INSTALL_STATUS_DOWNLOADING"
}
enum Categories: String {
case aws = "CAT_AWS"
case cryptocurrency = "CAT_CRYPTOCURRENCY"
case dev = "CAT_DEV"
case ecommerce = "CAT_E-COMMERCE"
case email = "CAT_EMAIL"
case environment = "CAT_ENVIRONMENT"
case finance = "CAT_FINANCE"
case games = "CAT_GAMES"
case lifestyle = "CAT_LIFESTYLE"
case messenger = "CAT_MESSENGER"
case music = "CAT_MUSIC"
case network = "CAT_NETWORK"
case politics = "CAT_POLITICS"
case science = "CAT_SCIENCE"
case sports = "CAT_SPORTS"
case system = "CAT_SYSTEM"
case time = "CAT_TIME"
case tools = "CAT_TOOLS"
case travel = "CAT_TRAVEL"
case tutorial = "CAT_TUTORIAL"
case weather = "CAT_WEATHER"
case web = "CAT_WEB"
}
}
extension RawRepresentable where RawValue == String {

View File

@ -57,3 +57,27 @@
"APP_QUIT" = "Quite SwiftBar";
"OK" = "Ok";
"CANCEL" = "Cancel";
// Plugin Repository Categories
"CAT_AWS" = "AWS";
"CAT_CRYPTOCURRENCY" = "Cryptocurrency";
"CAT_DEV" = "Dev";
"CAT_E-COMMERCE" = "E-Commerce";
"CAT_EMAIL" = "Email";
"CAT_ENVIRONMENT" = "Environment";
"CAT_FINANCE" = "Finance";
"CAT_GAMES" = "Games";
"CAT_LIFESTYLE" = "Lifestyle";
"CAT_MESSENGER" = "Messenger";
"CAT_MUSIC" = "Music";
"CAT_NETWORK" = "Network";
"CAT_POLITICS" = "Politics";
"CAT_SCIENCE" = "Science";
"CAT_SPORTS" = "Sports";
"CAT_SYSTEM" = "System";
"CAT_TIME" = "Time";
"CAT_TOOLS" = "Tools";
"CAT_TRAVEL" = "Travel";
"CAT_TUTORIAL" = "Tutorial";
"CAT_WEATHER" = "Weather";
"CAT_WEB" = "Web";

View File

@ -58,3 +58,27 @@
"APP_QUIT" = "Quit SwiftBar";
"OK" = "OK";
"CANCEL" = "Cancel";
// Plugin Repository Categories
"CAT_AWS" = "AWS";
"CAT_CRYPTOCURRENCY" = "Cryptocurrency";
"CAT_DEV" = "Dev";
"CAT_E-COMMERCE" = "E-Commerce";
"CAT_EMAIL" = "Email";
"CAT_ENVIRONMENT" = "Environment";
"CAT_FINANCE" = "Finance";
"CAT_GAMES" = "Games";
"CAT_LIFESTYLE" = "Lifestyle";
"CAT_MESSENGER" = "Messenger";
"CAT_MUSIC" = "Music";
"CAT_NETWORK" = "Network";
"CAT_POLITICS" = "Politics";
"CAT_SCIENCE" = "Science";
"CAT_SPORTS" = "Sports";
"CAT_SYSTEM" = "System";
"CAT_TIME" = "Time";
"CAT_TOOLS" = "Tools";
"CAT_TRAVEL" = "Travel";
"CAT_TUTORIAL" = "Tutorial";
"CAT_WEATHER" = "Weather";
"CAT_WEB" = "Web";

View File

@ -58,3 +58,28 @@
"APP_QUIT" = "Zatvori SwiftBar";
"OK" = "U redu";
"CANCEL" = "Odustani";
// Plugin Repository Categories
"CAT_AWS" = "AWS";
"CAT_CRYPTOCURRENCY" = "Cryptocurrency";
"CAT_DEV" = "Dev";
"CAT_E-COMMERCE" = "E-Commerce";
"CAT_EMAIL" = "Email";
"CAT_ENVIRONMENT" = "Environment";
"CAT_FINANCE" = "Finance";
"CAT_GAMES" = "Games";
"CAT_LIFESTYLE" = "Lifestyle";
"CAT_MESSENGER" = "Messenger";
"CAT_MUSIC" = "Music";
"CAT_NETWORK" = "Network";
"CAT_POLITICS" = "Politics";
"CAT_SCIENCE" = "Science";
"CAT_SPORTS" = "Sports";
"CAT_SYSTEM" = "System";
"CAT_TIME" = "Time";
"CAT_TOOLS" = "Tools";
"CAT_TRAVEL" = "Travel";
"CAT_TUTORIAL" = "Tutorial";
"CAT_WEATHER" = "Weather";
"CAT_WEB" = "Web";

View File

@ -57,3 +57,27 @@
"APP_QUIT" = "Stop SwiftBar";
"OK" = "OK";
"CANCEL" = "Annuleer";
// Plugin Repository Categories
"CAT_AWS" = "AWS";
"CAT_CRYPTOCURRENCY" = "Cryptocurrency";
"CAT_DEV" = "Dev";
"CAT_E-COMMERCE" = "E-Commerce";
"CAT_EMAIL" = "Email";
"CAT_ENVIRONMENT" = "Environment";
"CAT_FINANCE" = "Finance";
"CAT_GAMES" = "Games";
"CAT_LIFESTYLE" = "Lifestyle";
"CAT_MESSENGER" = "Messenger";
"CAT_MUSIC" = "Music";
"CAT_NETWORK" = "Network";
"CAT_POLITICS" = "Politics";
"CAT_SCIENCE" = "Science";
"CAT_SPORTS" = "Sports";
"CAT_SYSTEM" = "System";
"CAT_TIME" = "Time";
"CAT_TOOLS" = "Tools";
"CAT_TRAVEL" = "Travel";
"CAT_TUTORIAL" = "Tutorial";
"CAT_WEATHER" = "Weather";
"CAT_WEB" = "Web";

View File

@ -151,7 +151,7 @@ struct SplitView: View {
Image(systemName: PluginRepository.categorySFImage(category))
.frame(width: 20)
}
Text(category)
Text(Localizable.Categories(rawValue: "CAT_\(category.uppercased())")?.localized ?? category)
.font(.headline)
}
}