Fix a problem that prevents proper support for variable keys#2
Fix a problem that prevents proper support for variable keys#2sergiou87 merged 2 commits intosergiou87:masterfrom
Conversation
|
Thanks for your work @danielmartin !! I like the idea but I think this change doesn't get along with Localizable.strings: OtherTable.strings: I changed the example to work with I don't like it failing miserably, but I don't like it just working without informing the user. Would you mind editing If you want to test your changes in |
…ext, or table name is a non-literal string
|
@danielmartin Wow! I just noticed you changed |
|
@sergiou87 I think that's enough. The change does warn the user if a non-literal string is found in keys, contexts, or table names (indicating file name and line number, same information as in I think there's still a problem when there are comments inside |
|
Yeah, the problem is it's based on parsing the code files manually, rather than using something like libclang (which actually understands Objective-C… and Swift when it's needed 😄 ). I started writing a tool in Python based on libclang but I couldn't get enough free time to finish it 😕 Anyway, thank you very much for your contribution, I'll add you to the README file too, and I hope I can get you a 🍺 some time!! 😄 |
Fix a problem that prevents proper support for variable keys
If you try to pass a variable key to the SPLocalizedString/SPLocalizedStringPlural macros, the program doesn't even compile due to a problem with C macro expansion. NSLocalizedString supports variable keys, so SPLocalizedString should too.
This pull request implements the changes required so that you can pass either a constant or a variable key to SPLocalizedString/SPLocalizedStringPlural.
I've also modified the sample project to test that the fix is working fine and no regressions are introduced.