14

I have generated my strings file correctly using genstrings. I have changed the localized strings for my different languages. Now, I have added a few more NSLocalizedString() occurrences and I want to generate those into all of my localized strings files.

But, running genstrings again does not seem to update my strings files. Am I doing something wrong?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
  • As Michal proposed, I put a [little script](https://github.com/anlcan/AcbUpdateStrings) together to help me update my resources. hope it helps – aimless Jul 26 '14 at 12:43

2 Answers2

10

Usually this is because you've got genstrings looking in the wrong folder, or in the wrong files. I had a problem where it wasn't picking up all of my strings, and I realized it was only searching for *.m files (not *.mm) and it wasn't parsing the files in my Classes folder. A small change fixed that:

genstrings -o Classes/en.lproj Classes/*.{m,mm}

The first parameter tells genstrings where I want the .strings file.

  • -o Classes/en.lprog

The second parameter tells genstrings where to look. Remember I'm running genstrings from the project root, so I needed to specify Classes/.m, or more specifically Classes/.{m,mm} so it would parse .m and .mm files.

Terry Blanchard
  • 449
  • 6
  • 7
-2

the -a option should append new values to your translations

cynistersix
  • 1,215
  • 1
  • 16
  • 30
  • 1
    Well, `-a` causes results to be appended to the end of the old file and not merged. I wrote a ruby script that does the merging with previous translations. I think app nibTranslate should do the trick too. – Michal Jul 22 '11 at 18:40
  • 1
    see that I said new values here i never said anything about merging nor does the question... glad we are clear here. – cynistersix Dec 13 '11 at 23:34
  • cynistersix: A helpful response would acknowledge that - in the context of what the original poster is trying to do - simply appending all of the generated strings (both existing AND new) to the end of the file would likely be undesirable and/or unexpected. Michal's comment provided useful additional info. – Jeff C. Jun 11 '15 at 09:25
  • Michal: Thank you for that bit of knowledge and for your helpful recommendation nibTranslate. It'd sure be nice if Apple added merging support to genstrings as this seems like an obvious use case. – Jeff C. Jun 11 '15 at 09:26