Would be great to support SwiftGen
JuliusBahr opened this issue · 7 comments
JuliusBahr commented
Hey
we use SwiftGen in our code base and I would like to use Localize too.
I have created a patch that adds SwiftGen support and adds additional logging. Unfortunately I have no rights to create a PR, so I will paste below.
With best regards
Julius
diff --git a/Localize.swift b/Localize.swift
index 7f05cf6..de82525 100755
--- a/Localize.swift
+++ b/Localize.swift
@@ -26,7 +26,8 @@ let relativeSourceFolder = ""
*/
let patterns = [
"NSLocalizedString\\(@?\"(\\w+)\"", // Swift and Objc Native
- "Localizations\\.((?:[A-Z]{1}[a-z]*[A-z]*)*(?:\\.[A-Z]{1}[a-z]*[A-z]*)*)" // Laurine Calls
+ "Localizations\\.((?:[A-Z]{1}[a-z]*[A-z]*)*(?:\\.[A-Z]{1}[a-z]*[A-z]*)*)", // Laurine Calls
+ "L10n.tr\\(key: \"(\\w+)\""// SwiftGen generation
]
/*
@@ -64,8 +65,13 @@ let masterLanguage = "en"
func listSupportedLanguages() -> [String] {
var sl = [String]()
let path = FileManager.default.currentDirectoryPath + relativeLocalizableFolders
+ if !FileManager.default.fileExists(atPath: path) {
+ print("Invalid configuration: \(path) does not exist.")
+ exit(1)
+ }
let enumerator: FileManager.DirectoryEnumerator? = FileManager.default.enumerator(atPath: path)
let extensionName = "lproj"
+ print("Found these languages:")
while let element = enumerator?.nextObject() as? String {
if element.hasSuffix(extensionName) {
:...skipping...
diff --git a/Localize.swift b/Localize.swift
index 7f05cf6..de82525 100755
--- a/Localize.swift
+++ b/Localize.swift
@@ -26,7 +26,8 @@ let relativeSourceFolder = ""
*/
let patterns = [
"NSLocalizedString\\(@?\"(\\w+)\"", // Swift and Objc Native
- "Localizations\\.((?:[A-Z]{1}[a-z]*[A-z]*)*(?:\\.[A-Z]{1}[a-z]*[A-z]*)*)" // Laurine Calls
+ "Localizations\\.((?:[A-Z]{1}[a-z]*[A-z]*)*(?:\\.[A-Z]{1}[a-z]*[A-z]*)*)", // Laurine Calls
+ "L10n.tr\\(key: \"(\\w+)\""// SwiftGen generation
]
/*
@@ -64,8 +65,13 @@ let masterLanguage = "en"
func listSupportedLanguages() -> [String] {
var sl = [String]()
let path = FileManager.default.currentDirectoryPath + relativeLocalizableFolders
+ if !FileManager.default.fileExists(atPath: path) {
+ print("Invalid configuration: \(path) does not exist.")
+ exit(1)
+ }
let enumerator: FileManager.DirectoryEnumerator? = FileManager.default.enumerator(atPath: path)
let extensionName = "lproj"
+ print("Found these languages:")
while let element = enumerator?.nextObject() as? String {
if element.hasSuffix(extensionName) {
print(element)
s4cha commented
@JuliusBahr
How come you don't have PR rights? That is a very welcome addition :)
JuliusBahr commented
No definitely not:
git push origin feature/supportSwiftGen:feature/supportSwiftGen
remote: Permission to freshOS/Localize.git denied to JuliusBahr.
fatal: unable to access 'https://github.com/freshOS/Localize.git/': The requested URL returned error: 403
… On 28 Mar 2017, at 15:54, S4cha ***@***.***> wrote:
@JuliusBahr <https://github.com/JuliusBahr>
How come you don't have PR rights? That is a very welcome addition :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQeZQCTfQ5nx6po259-G8nBZK0vWDNVjks5rqREhgaJpZM4MrkyV>.
maxkonovalov commented
Hi @JuliusBahr, to submit a PR you need to fork the repo first, and then push the changes to a branch on your own repo.
Hope this helps ;)
s4cha commented
@JuliusBahr if you don't feel like making a PR we can update it ourselves based on the diff you provided and mention you :) What do you think?
JuliusBahr commented
yep, please go ahead and thanks
… On 13. Apr 2017, at 11:37, S4cha ***@***.***> wrote:
@JuliusBahr <https://github.com/JuliusBahr> if you don't feel like making a PR we can update it ourselves based on the diff you provided and mention you :) What do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQeZQMnKWia6Fil5VIdsU1-vEFAb60eIks5rvezzgaJpZM4MrkyV>.
s4cha commented
@JuliusBahr the patch has been applied :
9be6923
s4cha commented
Thanks a lot :)