views:

485

answers:

3

Localizable strings file which are used for Apple/iPhone apps localization have the following format:

/* COMMENT */
"KEY" = "VALUE"

Note that KEY is unique in a given strings file.
COMMENT is optional however it can help the translator with some additional info.

Example:

/* Menu item to make the current document plain text */
"Make Plain Text" = "Make Plain Text";
/* Menu item to make the current document rich text */
"Make Rich Text" = "Make Rich Text";

I would like to diff/merge two strings files and optionally sort that kind of files. It would be great if the comments would be kept while doing these operations.

The format is quite simple and I could write let's say a python script to do that, but if somebody has already done that, I prefer not reinveting the wheel ;)

Do you know a tool that can manipulate strings file?

+1  A: 

You can try /Developer/Applications/Utilities/FileMerge.app. That's always a good start. Also, you should try genstrings.

Alexsander Akers
A: 

I found this tool from the Three20 project:

http://github.com/facebook/three20/blob/master/diffstrings.py

It answers my initial need in different way of what I had imagined:
it can diff between the main locale and the other locales to see what needs translating in each other locale. And then merge back the translated strings.

Note that it outputs xml files to give to the translators.

Jean Regisser
Is there any documentation on how to use diffstrings.py? I keep on getting errors: Traceback (most recent call last): File "diffstrings.py", line 656, in <module> main() File "diffstrings.py", line 638, in main projects = list(openProjects(projectPaths, options.locale)) ...and so on. This tool seems amazingly valuable; I just don't know enough about Python to figure out what's going wrong. (Even the arguments to be passed in as paths seem mysterious. "Source files?" Which source files?) Any help would be appreciated.
Greg Maletic
+4  A: 

I was desperate to find a decent way to manages Localized.strings during development, when there are new strings added to the code and you don't want to manually manage all the files.

I found Localization Manager that does this quite well. It has a nonexistent documentation, but comes with a separate program for the translators. It imports your strings, keeps track of changes and exports the needed Localization.strings files back to your project.

Up till now it seems to be freeware.

chaos0815
Localization Manager is awesome! The end of my nightmare! How can the diffstring script be the accepted solution here when this tool does it a 1000 times better!?
Martin
What I don't get is, why this site does not even mention how to use that? There's zero information on that page, and a lot of different files to download. Really strange project.
dontWatchMyProfile