I think this is either a mistake genstringsor a “function”, but she wanted to know if anyone had met this or knew the answer. I planned to open a radar for this.
We use our own localization macro. Let me call him CustomLocalizedString. It is quite large in our code base, and we use many third-party libraries. For the vast majority of third-party libraries, we do not need any of their localized strings, if any. When we want to use their localized strings, we modify the 3rd Party lib to use our macro CustomLocalizedString. Since the strings we don't need use macros NSLocalizedString*, the thought was that this was not a problem.
Localization basically began to flag a few lines with problems. After a little research, I realized that this comes from the third batch. Then I realized that we also included other lines that should not be there (we have a large number of lines). These were strings using NSLocalizedString*marco.
So our call genstringslooks something like this:
genstrings -o output -s CustomLocalizedString
I do use xargsand findto create a file of arguments, so for the sake of brevity I omit that part. On the basis of the output looks like that genstringsputs a line NSLocalizedStringand CustomLocalizedStringa file Localizable.strings.
For further verification, I created a file with this:
NSLocalizedString(@"Normal localized string macro", nil);
CustomLocalizedString(@"Custom localized string macro", nil);
And ran:
genstrings -o out -s CustomLocalizedString localized_string.txt
The output was:
"Custom localized string macro" = "Custom localized string macro";
"Normal localized string macro" = "Normal localized string macro";
Running man genstringsgives the following:
-s routine
Substitutes routine for NSLocalizedString. For example, -s MyLocalString will catch calls to MyLocalString and MyLocalStringFromTable.
What makes it sound like NSLocalizedString*macros will be ignored, but it is not.
. find, , . 3- . , , - , lib CustomLocalizedString, Else , - , genstrings, , , , , genstrings find .