Search for usages of localized text

I'm using "search for usages" and "renaming" refactorings for translations all the time. It works great and I love the support. I'm using 2.5.5 and also the 3.0 EAP.

With one project I ran into a strange problem where these refactorings doesn't work.

When I try to "search for usages" I'm getting "Cannot search for usages - Position to an element to find usages for, and try again" ... and when I try try a "renaming" it simply doesn't do anything (usually you will get the token marked with red).

It has surely something to do with App Code not being able to find my localized files properly but I have tried to clean everything and still can't get it to recognize it.

The strange part is I _am_ able to add new localizations and they are added to both files ... however they are only added with the initial name I get i.e. when I write

NSString *foo = @"bar";

and then use the "Localize the string" action it will generate a key named "bar" in all my localized file but it will not update it when I type the real name.

Also when I go into the localized files it seems like App Code _is_ able to figure out which keys are in use and which not (by graying out the one which isn't) however I can't navigate from the localized files either i.e. all "find usages" will result in "no usages found in project files".

Any idea how I could solve this?

1 comment

It was my own mistake. I had a macro defining the "NSLocalizedString" because I had previously called this "_t" but had renamed it and wasn't aware App Code renamed the macro too.

Once I removed this re-definition of the macro and cleans everything and restarted App Code it worked beautifully again.

0

Please sign in to leave a comment.