BartyCrouch
BartyCrouch copied to clipboard
Custom Function parsing issue
I used custom function: -f "LLS"
to parse the localized strings:
LLS(@"LOC_BASE_INFO", @""), LLS(@"LOC_UPGRADE", @""), LLS(@"LOC_CRAFT_PRICE", @""), LLS(@"LOC_SKILLS", @""), LLS(@"LOC_SET_SKILLS", @""), LLS(@"LOC_CRAFT_MATERIALS", @"")
it will work good if there are no repeated keys in the Localizable.strings file, but when there are, the parsing will stop at the repeated key.
Consider the line above, if there is already a key named 'LOC_SKILLS' in the Localizable.strings, the keys after it won't be parsed. As a result, LOC_SET_SKILLS and LOC_CRAFT_MATERIALS are not in the Localizable.strings after parsing.
addition: it seems not quite the reason I mentioned, and the issue is with genstrings.
Okay, after a little test, it seems to be a bug of genstrings. And I realize I cannot do anything to fix the problem, I have to look for another solution:
https://github.com/Cocoanetics/DTLocalizableStringScanner
I tried the same file for parsing ,it got me the right answer.
So would you like to use this solution to replace the original genstrings?
Hi @rockingdice and thank you for both the PR and investigating this issue.
Please note that besides genstrings
we also support its successor extract-loc-strings
, see here in the docs. Would you mind trying that option out first? I'm not sure, but maybe that tool might fix your issue.
If it doesn't though, I'm happy to review and merge a good PR that adds the DTLocalizableStringScanner
as an alternative to genstrings
optionally just as extract-loc-strings
currently is configurable. Please don't forget to add tests and docs for your change request, then it can be merged quickly and you can use the feature soon. Thanks in advance! 👍