From c599c88940486c5a0d0df04fd301c1d0b70580f2 Mon Sep 17 00:00:00 2001 From: Egzon Arifi Date: Mon, 23 Sep 2024 10:26:22 +0200 Subject: [PATCH 1/4] Chore/Move to project folders (#211) --- .../xcshareddata/xcschemes/Lingua.xcscheme | 2 +- .../xcshareddata/xcschemes/LinguaLib.xcscheme | 2 +- .../xcschemes/LinguaTests.xcscheme | 2 +- .../Lingua/Lingua.xcodeproj/project.pbxproj | 348 ++---------------- .../xcshareddata/xcschemes/LinguaApp.xcscheme | 2 +- .../Common/Foundation/CustomJSONEncoder.swift | 2 +- ...egularExpressionPlaceholderExtractor.swift | 4 +- 7 files changed, 32 insertions(+), 330 deletions(-) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/Lingua.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Lingua.xcscheme index 8dcb9d1..e59ff6d 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/Lingua.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Lingua.xcscheme @@ -1,6 +1,6 @@ (_ value: T) throws -> Data { let encoder = JSONEncoder() encoder.outputFormatting = .prettyPrinted diff --git a/Sources/LinguaLib/Infrastructure/SwiftLocalizeGenerator/PlaceholderExtractor/NSRegularExpressionPlaceholderExtractor.swift b/Sources/LinguaLib/Infrastructure/SwiftLocalizeGenerator/PlaceholderExtractor/NSRegularExpressionPlaceholderExtractor.swift index c8686f6..fe3ec8b 100644 --- a/Sources/LinguaLib/Infrastructure/SwiftLocalizeGenerator/PlaceholderExtractor/NSRegularExpressionPlaceholderExtractor.swift +++ b/Sources/LinguaLib/Infrastructure/SwiftLocalizeGenerator/PlaceholderExtractor/NSRegularExpressionPlaceholderExtractor.swift @@ -4,8 +4,8 @@ struct NSRegularExpressionPlaceholderExtractor: PlaceholderExtractorStrategy { func extractPlaceholders(from translation: String, pattern: String) -> [Placeholder] { guard let regex = try? NSRegularExpression(pattern: pattern) else { return [] } - let matches = regex.matches(in: translation, - range: NSRange(location: 0, length: translation.count)) + let range = NSRange(location: 0, length: translation.count) + let matches = regex.matches(in: translation, range: range) return matches .enumerated() From 6e14ee959b60870f9344d4644b3f2423a5ca7dcd Mon Sep 17 00:00:00 2001 From: Egzon Arifi Date: Mon, 23 Sep 2024 10:26:35 +0200 Subject: [PATCH 2/4] Fix/Menu bar tint icon (#212) --- .../lingua_menu_bar_icon.imageset/Contents.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lingua-App/Lingua/Lingua/Resources/Assets.xcassets/lingua_menu_bar_icon.imageset/Contents.json b/Lingua-App/Lingua/Lingua/Resources/Assets.xcassets/lingua_menu_bar_icon.imageset/Contents.json index e6673bb..5f3e7cd 100644 --- a/Lingua-App/Lingua/Lingua/Resources/Assets.xcassets/lingua_menu_bar_icon.imageset/Contents.json +++ b/Lingua-App/Lingua/Lingua/Resources/Assets.xcassets/lingua_menu_bar_icon.imageset/Contents.json @@ -8,5 +8,8 @@ "info" : { "author" : "xcode", "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "template" } } From 57a1da780af6e0b1e5a7a805f70d5478077c9a31 Mon Sep 17 00:00:00 2001 From: Egzon Arifi Date: Mon, 23 Sep 2024 10:47:38 +0200 Subject: [PATCH 3/4] Update iOS info step (#213) --- Lingua-App/Lingua/Lingua/Resources/Localization/Lingua.swift | 2 +- .../Resources/Localization/en.lproj/ProjectForm.strings | 4 +++- README.md | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Lingua-App/Lingua/Lingua/Resources/Localization/Lingua.swift b/Lingua-App/Lingua/Lingua/Resources/Localization/Lingua.swift index 00b94d0..7d8d4a6 100644 --- a/Lingua-App/Lingua/Lingua/Resources/Localization/Lingua.swift +++ b/Lingua-App/Lingua/Lingua/Resources/Localization/Lingua.swift @@ -62,7 +62,7 @@ enum Lingua { static let inputProjectName = tr("ProjectForm", "input_project_name") /// Sheet ID * static let inputSheetId = tr("ProjectForm", "input_sheet_id") - /// After you "Localize", you have to Add files to "%@"... in Xcode, if they are not added already + /// After you "Localize", you have to Add files to "%@"... in Xcode, if they are not added already.\n\nNOTE: If you are using Xcode 16 and have structured your project using 'Folders' instead of 'Groups', this step is not necessary. static func iosLocalizationInfoMessage(_ param1: String) -> String { return tr("ProjectForm", "ios_localization_info_message", param1) } diff --git a/Lingua-App/Lingua/Lingua/Resources/Localization/en.lproj/ProjectForm.strings b/Lingua-App/Lingua/Lingua/Resources/Localization/en.lproj/ProjectForm.strings index 172c7f7..cfcd736 100644 --- a/Lingua-App/Lingua/Lingua/Resources/Localization/en.lproj/ProjectForm.strings +++ b/Lingua-App/Lingua/Lingua/Resources/Localization/en.lproj/ProjectForm.strings @@ -14,7 +14,9 @@ "localize_button" = "Localize"; "swift_code_toggle_title" = "Generate Swift Code"; "input_directory_button" = "Choose Directory"; -"ios_localization_info_message" = "After you \"Localize\", you have to Add files to \"%@\"... in Xcode, if they are not added already"; +"ios_localization_info_message" = "After you \"Localize\", you have to Add files to \"%@\"... in Xcode, if they are not added already. + +NOTE: If you are using Xcode 16 and have structured your project using 'Folders' instead of 'Groups', this step is not necessary."; "api_key_help" = "Here are the steps to enable the Google Sheets API and create an API key: * Go to the https://console.cloud.google.com/. diff --git a/README.md b/README.md index 10104a6..0146473 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,10 @@ Then in the configuration file created you need to provide your data, like below The output directory property should be the path where you want the tool to create localization files. -* For iOS it can be any directory on your project. After you run the command, for the first time, you have to **`Add files to 'YourProject'`** in Xcode. +* For iOS it can be any directory on your project. + + After you run the command, for the first time, you have to **`Add files to 'YourProject'`** in Xcode.\ + **NOTE:** If you are using Xcode 16 and have structured your project using **Folders** instead of **Groups**, this step is not necessary. * For Android, since the translation are placed in a specific project directory, the output directory it should look something like this: **`path/YourProject/app/src/main/res `** From 2fd1a4a62ca11ecbd008431d745c84e6b56672f7 Mon Sep 17 00:00:00 2001 From: Egzon Arifi Date: Mon, 23 Sep 2024 10:57:27 +0200 Subject: [PATCH 4/4] bump version --- Sources/LinguaLib/Common/Extensions/String+Extension.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/LinguaLib/Common/Extensions/String+Extension.swift b/Sources/LinguaLib/Common/Extensions/String+Extension.swift index 8b899f7..5e7c053 100644 --- a/Sources/LinguaLib/Common/Extensions/String+Extension.swift +++ b/Sources/LinguaLib/Common/Extensions/String+Extension.swift @@ -2,7 +2,7 @@ import Foundation public extension String { static let packageName = "Lingua" - static let version = "1.0.4" + static let version = "1.0.5" static let swiftLocalizedName = "\(String.packageName).swift" static let fileHeader = """ This file was generated with Lingua command line tool. Please do not change it!