To extract the string "marked" with NSLocalizedString in my iOS app, I use the following terminal command:

find . -name \*.m | xargs genstrings -o ro.lproj

This will basically extract all the marked strings in all the .m files and put them in the Localizable.strings file inside my project romanian's folder.

My problem is that I don't manage to get it to update the strings file. If I change/add some strings it will overwrite my old strings file.

I've look to the arguments the genstrings accepts, looked on the man page, and I don't seem to find the option to update the file instead of overwriting it.

How do I update the translation file ?

有帮助吗?

解决方案

genstrings doesn't do updates. If it did you'd still be stuck with the problem of what to do to manage updates to the localized files (which require the attention of a translator to make changes to their translations, particularly for edited source strings, so they need to see the differences in the source text).

There are tools designed for this. For example the Localization Suite desktop app (http://www.loc-suite.org/) and the Gengo String web app (http://gengo.com/string/about/)

其他提示

You could:

  • Use the -a flag which will append the strings to the existing file
  • Or, choose a different location for the output and use a file merge tool to collect the results.
  • Or use Version control to merge back previous versions.

Genstrings does not update, its a one way one time deal. I use the Linguan tool see http://www.peerassembly.com/linguan.html its not expensive and works great with xcode 5. You just point it to your xcode project and it will extract all strings from your code (simular to genstrings but without the commandline stuff) and build the .strings files. When you update your code, you ask Linguan to scan again and it will nicely tell you what the new strings are. You can also do other stuff like stats, export, import...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top