Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Eraserhead

macrumors G4
Original poster
Nov 3, 2005
10,434
12,250
UK
Hey guys

Is there a better version of genstrings that allows you to use the first value of NSLocalizedString only as a key and the second as the value?

Otherwise I think it'll be easier to write a new tool than to change what I've already written in my project :p.

Thanks
 
So I put my money where my mouth is and coded this solution - and you can download my hard work from Sourceforge at http://www.sourceforge.net/projects/cocoalocalizer/.


My blog said:
Rather than go back and redo my coding so that it would work I created a new program called CocoaLocalizer to do this hard work for me. This program creates better comments than genstrings as it allows you to import comments from an external file with the same keys, and it also displays the ‘default value’ in the comment so you can see what you’re translating from. Additionally it allows you to ‘merge’ another .strings file (though it misses the comments in that at the moment) into the one it generates. Also the application checks both the keys and values to make sure they don’t clash with existing values and displays a ‘nice’ error for this.

It also works with NSLocalizedString done in the default way as well (i.e. NSLocalizedString(keyValue, comment) and with that it just uses the extra comment from the comment.strings file as another comment.

This program has a Cocoa interface and isn’t a command line application and it requires Mac OS X 10.6 Snow Leopard.

(source)
 
You should make it a command-line tool, because that is often how genstrings is used and that's how we use it in a large project, where it takes several seconds (10-15) to process all our code (we only run it on Release atm). I don't think genstrings uses any sort of multi-threading, so that could be something to consider for yours as well (easy with NSOperation).

BTW the download from SF contained a folder with a .app extension, but it was only a normal folder, so it wouldn't open properly.
 
BTW the download from SF contained a folder with a .app extension, but it was only a normal folder, so it wouldn't open properly.

Fixed.

You should make it a command-line tool, because that is often how genstrings is used and that's how we use it in a large project, where it takes several seconds (10-15) to process all our code (we only run it on Release atm).

On D&D Manager genstrings takes 7.06 seconds (according to the Unix command time), whereas my code only takes 0.08 seconds (according to the creation of a date at the start/end of my method) which is a huge improvement - I haven't used any threading so far but I'm not sure its needed.

You should make it a command-line tool, because that is often how genstrings is used and that's how we use it in a large project,

Doing it as a command line application sounds like a good idea - I'll take a look at doing that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.