iPhone: Update Localizable.strings files using genstrings?
Asked Answered
G

2

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?

Goggle answered 29/9, 2010 at 22:54 Comment(1)
As Michal proposed, I put a little script together to help me update my resources. hope it helpsTight
K
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.

Kiowa answered 30/11, 2010 at 18:49 Comment(1)
Hm. What about other language files that have been (partially) translated?Pentane
A
-2

the -a option should append new values to your translations

Awlwort answered 19/7, 2011 at 23:22 Comment(4)
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.Sutra
see that I said new values here i never said anything about merging nor does the question... glad we are clear here.Awlwort
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.Lockman
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.Lockman

© 2022 - 2024 — McMap. All rights reserved.