Git diff for Localizable.strings Files
Developer
— 15 Apr 2010 03:41 — 763 days ago
Out of the box git diff doesn’t display a readable diff for Cocoa .strings files because it sees the UTF-16 encoded text files as binary files:
Binary files a/Localizable.strings and b/Localizable.strings differ
Not very useful. With two small configuration changes you can get a readable diff:
First, add this to the project’s .git/info/attributes file:
*.strings diff=localizablestrings
(Unfortunately you do have to add it to every project, there doesn’t seem to be a global attributes configuration file)
Second, add this to your ~/.gitconfig file:
[diff "localizablestrings"] textconv = "iconv -f utf-16 -t utf-8"
Now git diff shows nice readable diffs:

Comments
|



It's much easier: just write your strings files always in UTF-8! Then you have no problem with version control systems. Xcode will automatically convert to UTF-16BE when copying the files into the final product. :-)