I’m trying to figure out the best way to automatically add NSLocalizedString() around a string in xcode.
Ideally I’d like a way that I could position the cursor within @"foo", press a key binding, and it’d be turned into NSLocalizedString(@"foo", nil).
I’ve had a look at the documentation for user scripts and can’t see an obvious way to get the current cursor position.
Did I miss something, or is there another way to achieve the same result?
Thanks!
You can use %%%{PBXSelectionStart}%%%
From the apple documentation:
Procrastination brought you this script.
It works and does what it should. But it is very basic, and there are bugs, and this is probably not the best way to do it.
Don’t use @ and ” in the strings you want to replace. If I were you, I wouldn’t use it anyway. ^^
Script Input is
Selection, Output isReplace Document Contents