Hey all,
I'm developing a fully programmatically app (not sure if it matters) and get to the point where I want to localize it.
Most of my strings are look like this:
swift
cell.label.text = localized("Hello world")
where localized() is just a wrapper around NSLocalizedString():
swift
func localized(_ string: String) - String {
return NSLocalizedString(string, comment: "")
}
So, I added desirable languages to my project and created *.strings file, but when I do
bash
find ./ -name "*.swift" -exec echo {} \; -exec genstrings -s localized -a -o Resources/en.lproj {} \;
I get a lot of errors:
genstrings: error: bad entry in file ./bla-bla/myfile.swift (line = 30): Argument is not a literal string.
So, it seems that genstrings doesn't work with wrappers, though the man states:
s routine [-s routine ...]
Recognizes routine() as equivalent to NSLocalizedString(). For example, -s MyLocalString will catch calls to MyLocalString(), MyLocalStringFromTable(), and so on.
Am I missing something? Is there any way to generate a strings file except looking for some better tools on GitHub/creating my own?
5
0
3.3k