how make a localisation with NSPredicateEditorRowTemplate
it is not well documented it was a total pain to figure out.
all is written programmatically
I would like a French, Italian version etc.
how make a localisation with NSPredicateEditorRowTemplate
it is not well documented it was a total pain to figure out.
all is written programmatically
I would like a French, Italian version etc.
Localizing an NSPredicateEditor is a bit more involved than usual localisation.
First, you'll need to have NSLocalizedString() calls in your code somewhere so that genstrings is able to find them.
Secondly, the key needs to follow a special format that will instruct genstrings to produce all combinations of a given row:
NSLocalizedStringFromTable(@"%[Any, All, None]@ of the following are true", @"Predicate", @"localize the compound row template")
NSLocalizedStringFromTable(@"%[property]@ %[is, is not, contains, begins with, ends with, like, matches]@ %@", @"Predicate", @"localize the string row template")
NSLocalizedStringFromTable(@"%[birthMonth]@ %[is, is not]@ %[January, February, March, April, May, June, July, August, September, October, November, December]@", @"Predicate", @"localize the selection row template")
In the example above genstrings will look at the options between brackets and generate a localisation string for all combinations in the Predicate.strings file.
Finally, you must let your NSPredicateEditor instance know which strings file to use by setting the formattingStringsFilename
property.
See this blog post for more information.
the blog is a few years old.
xcode has improved over the years.
the question is duplicate but the answers may be different a few years later.
the answer is simple. it is the localization of the xib file and it works perfectly